Skip to content

Commit ac8a19b

Browse files
committed
Menubar: Fixed an issue with autoExpand binding that caused the menu to close on fast mouseenter by changing to _bind on the parent menubar item
1 parent c2f0362 commit ac8a19b

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

ui/jquery.ui.menubar.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,22 +123,6 @@ $.widget( "ui.menubar", {
123123
.attr( "aria-haspopup", "true" )
124124
.wrapInner( "<span class='ui-button-text'></span>" );
125125

126-
if ( that.options.autoExpand ) {
127-
input.bind( "mouseleave.menubar", function( event ) {
128-
that.timer = setTimeout( function() {
129-
that._close();
130-
}, 150 );
131-
});
132-
menu.bind( "mouseleave.menubar", function( event ) {
133-
that.timer = setTimeout( function() {
134-
that._close();
135-
}, 150 );
136-
})
137-
.bind( "mouseenter.menubar", function( event ) {
138-
clearTimeout( that.timer );
139-
});
140-
}
141-
142126
// TODO review if these options are a good choice, maybe they can be merged
143127
if ( that.options.menuIcon ) {
144128
input.addClass( "ui-state-default" ).append( "<span class='ui-button-icon-secondary ui-icon ui-icon-triangle-1-s'></span>" );
@@ -169,6 +153,15 @@ $.widget( "ui.menubar", {
169153
}, 100);
170154
}
171155
});
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+
}
172165
},
173166

174167
_destroy : function() {

0 commit comments

Comments
 (0)