aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/menu/menu_events.js15
-rw-r--r--ui/jquery.ui.menu.js8
2 files changed, 21 insertions, 2 deletions
diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js
index 554c4c516..4b152dcf4 100644
--- a/tests/unit/menu/menu_events.js
+++ b/tests/unit/menu/menu_events.js
@@ -619,4 +619,19 @@ test( "ensure default is prevented when clicking on anchors in disabled menus ",
equal( logOutput(), "click,1,afterclick,disable,enable,3", "Click order not valid." );
});
+test( "#9469: Stopping propagation in a select event should not suppress subsequent select events.", function() {
+ expect( 1 );
+ var element = $( "#menu1" ).menu({
+ select: function( event, ui ) {
+ log();
+ event.stopPropagation();
+ }
+ });
+
+ click( element, "1" );
+ click( element, "2" );
+
+ equal( logOutput(), "1,2", "Both select events were not triggered." );
+});
+
})( jQuery );
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index c0222629d..b4f0d48c1 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -75,9 +75,13 @@ $.widget( "ui.menu", {
"click .ui-menu-item:has(a)": function( event ) {
var target = $( event.target ).closest( ".ui-menu-item" );
if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
- this.mouseHandled = true;
-
this.select( event );
+
+ // Only set the mouseHandled flag if the event will bubble, see #9469.
+ if ( !event.isPropagationStopped() ) {
+ this.mouseHandled = true;
+ }
+
// Open submenu on click
if ( target.has( ".ui-menu" ).length ) {
this.expand( event );