From 17b5386e8cb48c522ddb581a001fef5434e57f9a Mon Sep 17 00:00:00 2001 From: Scott González Date: Sat, 17 Oct 2015 17:53:15 -0400 Subject: 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 --- ui/widgets/mouse.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ui') 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(); }, -- cgit v1.2.3