mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Create mouseHandled flag per instance instead of globally. Fixes #8866 - Menu: select event not firing due to mouseHandled flag reset bug
This commit is contained in:
parent
2c3d311f90
commit
5143b7f672
9
ui/jquery.ui.menu.js
vendored
9
ui/jquery.ui.menu.js
vendored
@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
(function( $, undefined ) {
|
(function( $, undefined ) {
|
||||||
|
|
||||||
var mouseHandled = false;
|
|
||||||
|
|
||||||
$.widget( "ui.menu", {
|
$.widget( "ui.menu", {
|
||||||
version: "@VERSION",
|
version: "@VERSION",
|
||||||
defaultElement: "<ul>",
|
defaultElement: "<ul>",
|
||||||
@ -40,6 +38,7 @@ $.widget( "ui.menu", {
|
|||||||
|
|
||||||
_create: function() {
|
_create: function() {
|
||||||
this.activeMenu = this.element;
|
this.activeMenu = this.element;
|
||||||
|
this.mouseHandled = false;
|
||||||
this.element
|
this.element
|
||||||
.uniqueId()
|
.uniqueId()
|
||||||
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
|
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
|
||||||
@ -73,8 +72,8 @@ $.widget( "ui.menu", {
|
|||||||
},
|
},
|
||||||
"click .ui-menu-item:has(a)": function( event ) {
|
"click .ui-menu-item:has(a)": function( event ) {
|
||||||
var target = $( event.target ).closest( ".ui-menu-item" );
|
var target = $( event.target ).closest( ".ui-menu-item" );
|
||||||
if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) {
|
if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
|
||||||
mouseHandled = true;
|
this.mouseHandled = true;
|
||||||
|
|
||||||
this.select( event );
|
this.select( event );
|
||||||
// Open submenu on click
|
// Open submenu on click
|
||||||
@ -130,7 +129,7 @@ $.widget( "ui.menu", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset the mouseHandled flag
|
// Reset the mouseHandled flag
|
||||||
mouseHandled = false;
|
this.mouseHandled = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user