Skip to content

Commit 17b5386

Browse files
committed
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 jquerygh-1620
1 parent 60fa118 commit 17b5386

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ui/widgets/mouse.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,16 @@ return $.widget( "ui.mouse", {
146146

147147
// Iframe mouseup check - mouseup occurred in another document
148148
} else if ( !event.which ) {
149-
return this._mouseUp( event );
149+
150+
// Support: Safari <=8 - 9
151+
// Safari sets which to 0 if you press any of the following keys
152+
// during a drag (#14461)
153+
if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
154+
event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
155+
this.ignoreMissingWhich = true;
156+
} else if ( !this.ignoreMissingWhich ) {
157+
return this._mouseUp( event );
158+
}
150159
}
151160
}
152161

@@ -188,6 +197,7 @@ return $.widget( "ui.mouse", {
188197
delete this._mouseDelayTimer;
189198
}
190199

200+
this.ignoreMissingWhich = false;
191201
mouseHandled = false;
192202
event.preventDefault();
193203
},

0 commit comments

Comments
 (0)