aboutsummaryrefslogtreecommitdiffstats
path: root/ui/widgets/menu.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2017-04-18 16:51:23 -0400
committerScott González <scott.gonzalez@gmail.com>2017-05-02 15:16:17 -0400
commit50efd6e1b063822c4a0ecb38f324ed3354f387c4 (patch)
treec7d0a0809f5a8dfa8ab744e58556f27e756d6fe5 /ui/widgets/menu.js
parent7d992ae29d27cdab8787691a14e689e60c74c05c (diff)
downloadjquery-ui-50efd6e1b063822c4a0ecb38f324ed3354f387c4.tar.gz
jquery-ui-50efd6e1b063822c4a0ecb38f324ed3354f387c4.zip
Menu: Ignore mouse events triggered due to page scrolling
Fixes #9356 Closes gh-1806
Diffstat (limited to 'ui/widgets/menu.js')
-rw-r--r--ui/widgets/menu.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/ui/widgets/menu.js b/ui/widgets/menu.js
index 5df9d3eef..302d202ae 100644
--- a/ui/widgets/menu.js
+++ b/ui/widgets/menu.js
@@ -64,6 +64,7 @@ return $.widget( "ui.menu", {
// Flag used to prevent firing of the click handler
// as the event bubbles up through nested menus
this.mouseHandled = false;
+ this.lastMousePosition = { x: null, y: null };
this.element
.uniqueId()
.attr( {
@@ -161,6 +162,17 @@ return $.widget( "ui.menu", {
return;
}
+ // If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356)
+ if ( event.clientX === this.lastMousePosition.x &&
+ event.clientY === this.lastMousePosition.y ) {
+ return;
+ }
+
+ this.lastMousePosition = {
+ x: event.clientX,
+ y: event.clientY
+ };
+
var actualTarget = $( event.target ).closest( ".ui-menu-item" ),
target = $( event.currentTarget );