Skip to content

Commit ec7968b

Browse files
author
Adam McCrea
committed
Fix mouse event propagation in IE
Nested sortables were breaking. Dragging an inner sortable item would also drag the outer item. This is due to IE not persisting the state of event.originalEvent.mouseHandled.
1 parent 4deb824 commit ec7968b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ui/jquery.ui.mouse.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
*/
1313
(function( $, undefined ) {
1414

15+
var mouseHandled = false;
16+
17+
$(document).mousedown(function(e) {
18+
mouseHandled = false;
19+
})
20+
1521
$.widget("ui.mouse", {
1622
options: {
1723
cancel: ':input,option',
@@ -44,9 +50,7 @@ $.widget("ui.mouse", {
4450

4551
_mouseDown: function(event) {
4652
// don't let more than one widget handle mouseStart
47-
// TODO: figure out why we have to use originalEvent
48-
event.originalEvent = event.originalEvent || {};
49-
if (event.originalEvent.mouseHandled) { return; }
53+
if (mouseHandled) { return; }
5054

5155
// we may have missed mouseup (out of window)
5256
(this._mouseStarted && this._mouseUp(event));
@@ -91,7 +95,7 @@ $.widget("ui.mouse", {
9195
// anymore, so this fix is needed
9296
($.browser.safari || event.preventDefault());
9397

94-
event.originalEvent.mouseHandled = true;
98+
mouseHandled = true;
9599
return true;
96100
},
97101

0 commit comments

Comments
 (0)