Skip to content

Commit 8d09f75

Browse files
fxkborchers
authored andcommitted
Menubar: moved mouseleave _bind call into existing _bind block, added the mouseenter binding back in to help with accidental quick mouseouts causing the menu to close and use same close time for all
1 parent 5dcaacc commit 8d09f75

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

ui/jquery.ui.menubar.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ $.widget( "ui.menubar", {
9494
}
9595
if ( ( that.open && event.type == "mouseenter" ) || event.type == "click" || that.options.autoExpand ) {
9696
if( that.options.autoExpand ) {
97-
clearTimeout( that.timer );
97+
clearTimeout( that.closeTimer );
9898
}
9999

100100
that._open( event, menu );
@@ -150,18 +150,19 @@ $.widget( "ui.menubar", {
150150
focusout: function( event ) {
151151
that.closeTimer = setTimeout( function() {
152152
that._close( event );
153-
}, 100);
153+
}, 150);
154+
},
155+
"mouseleave .ui-menubar-item": function( event ) {
156+
if ( that.options.autoExpand ) {
157+
that.closeTimer = setTimeout( function() {
158+
that._close( event );
159+
}, 150);
160+
}
161+
},
162+
"mouseenter .ui-menubar-item": function( event ) {
163+
clearTimeout( that.closeTimer );
154164
}
155165
});
156-
if ( that.options.autoExpand ) {
157-
that._bind( {
158-
"mouseleave .ui-menubar-item": function( event ) {
159-
that.timer = setTimeout( function() {
160-
that._close();
161-
}, 150 );
162-
}
163-
});
164-
}
165166
},
166167

167168
_destroy : function() {

0 commit comments

Comments
 (0)