aboutsummaryrefslogtreecommitdiffstats
path: root/ui/menu.js
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2015-04-08 16:09:17 +0200
committerJörn Zaefferer <joern.zaefferer@gmail.com>2015-04-08 16:34:26 +0200
commitc770605db05347edfa9c6224aebd42974092ed22 (patch)
tree30b5150da4ff957bbc62956b5ad3ded734be65eb /ui/menu.js
parent2d0f05b25dfd308f306ffb2fe1e42380b3b3daa7 (diff)
downloadjquery-ui-c770605db05347edfa9c6224aebd42974092ed22.tar.gz
jquery-ui-c770605db05347edfa9c6224aebd42974092ed22.zip
Menu: Ignore bubbled mouseenter events on parent items
Test uses QUnit 2.x API - inconsistent with the other tests, but also a good reference. Fixes #11641 Closes gh-1535
Diffstat (limited to 'ui/menu.js')
-rw-r--r--ui/menu.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/ui/menu.js b/ui/menu.js
index 3df6cb204..89281e4f0 100644
--- a/ui/menu.js
+++ b/ui/menu.js
@@ -108,13 +108,22 @@ return $.widget( "ui.menu", {
}
},
"mouseenter .ui-menu-item": function( event ) {
+
// Ignore mouse events while typeahead is active, see #10458.
// Prevents focusing the wrong item when typeahead causes a scroll while the mouse
// is over an item in the menu
if ( this.previousFilter ) {
return;
}
- var target = $( event.currentTarget );
+
+ var actualTarget = $( event.target ).closest( ".ui-menu-item" ),
+ target = $( event.currentTarget );
+
+ // Ignore bubbled events on parent items, see #11641
+ if ( actualTarget[ 0 ] !== target[ 0 ] ) {
+ return;
+ }
+
// Remove ui-state-active class from siblings of the newly focused menu item
// to avoid a jump caused by adjacent elements both having a class with a border
this._removeClass( target.siblings().children( ".ui-state-active" ),