2020$ . widget ( "ui.menubar" , {
2121 version : "@VERSION" ,
2222 options : {
23+ autoExpand : false ,
2324 buttons : false ,
2425 menuIcon : false ,
2526 position : {
@@ -89,7 +90,11 @@ $.widget( "ui.menubar", {
8990 that . _close ( ) ;
9091 return ;
9192 }
92- if ( ( that . open && event . type == "mouseenter" ) || event . type == "click" ) {
93+ if ( ( that . open && event . type == "mouseenter" ) || event . type == "click" || that . options . autoExpand ) {
94+ if ( that . options . autoExpand ) {
95+ clearTimeout ( that . timer ) ;
96+ }
97+
9398 that . _open ( event , menu ) ;
9499 }
95100 } )
@@ -115,6 +120,22 @@ $.widget( "ui.menubar", {
115120 . attr ( "role" , "menuitem" )
116121 . attr ( "aria-haspopup" , "true" )
117122 . wrapInner ( "<span class='ui-button-text'></span>" ) ;
123+
124+ if ( that . options . autoExpand ) {
125+ input . bind ( "mouseleave.menubar" , function ( event ) {
126+ that . timer = setTimeout ( function ( ) {
127+ that . _close ( ) ;
128+ } , 150 ) ;
129+ } ) ;
130+ menu . bind ( "mouseleave.menubar" , function ( event ) {
131+ that . timer = setTimeout ( function ( ) {
132+ that . _close ( ) ;
133+ } , 150 ) ;
134+ } )
135+ . bind ( "mouseenter.menubar" , function ( event ) {
136+ clearTimeout ( that . timer ) ;
137+ } ) ;
138+ }
118139
119140 // TODO review if these options are a good choice, maybe they can be merged
120141 if ( that . options . menuIcon ) {
0 commit comments