diff options
author | Scott González <scott.gonzalez@gmail.com> | 2015-10-17 17:53:15 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-10-27 14:12:00 -0400 |
commit | 17b5386e8cb48c522ddb581a001fef5434e57f9a (patch) | |
tree | e8319d0c9e4e38430776c701f8d0db1a50f9c2cb /ui | |
parent | 60fa118955aab65e66995454f4e7b228a49c4177 (diff) | |
download | jquery-ui-17b5386e8cb48c522ddb581a001fef5434e57f9a.tar.gz jquery-ui-17b5386e8cb48c522ddb581a001fef5434e57f9a.zip |
Mouse: Ignore `mousemove` events triggered by key presses in Safari
If the user presses control, meta, shift, or alt during a drag operation,
Safari will trigger an event where `event.which` is `0`. We use that scenario
to detect that a `mouseup` occurred in a different document, so we need to
ignore these events when one of the keys are pressed.
Fixes #14461
Closes gh-1620
Diffstat (limited to 'ui')
-rw-r--r-- | ui/widgets/mouse.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ui/widgets/mouse.js b/ui/widgets/mouse.js index 30e5d35eb..c14aebe53 100644 --- a/ui/widgets/mouse.js +++ b/ui/widgets/mouse.js @@ -146,7 +146,16 @@ return $.widget( "ui.mouse", { // Iframe mouseup check - mouseup occurred in another document } else if ( !event.which ) { - return this._mouseUp( event ); + + // Support: Safari <=8 - 9 + // Safari sets which to 0 if you press any of the following keys + // during a drag (#14461) + if ( event.originalEvent.altKey || event.originalEvent.ctrlKey || + event.originalEvent.metaKey || event.originalEvent.shiftKey ) { + this.ignoreMissingWhich = true; + } else if ( !this.ignoreMissingWhich ) { + return this._mouseUp( event ); + } } } @@ -188,6 +197,7 @@ return $.widget( "ui.mouse", { delete this._mouseDelayTimer; } + this.ignoreMissingWhich = false; mouseHandled = false; event.preventDefault(); }, |