Skip to content

Commit a41280d

Browse files
committed
Attach mousemove/end events to document, not window. Fixes IE9 and IE10 compat.
IE8 is hopeless; doesn't work with React anyway.
1 parent 430afe7 commit a41280d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/draggable.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ module.exports = React.createClass({
472472

473473
componentWillUnmount: function() {
474474
// Remove any leftover event handlers
475-
removeEvent(window, dragEventFor['move'], this.handleDrag);
476-
removeEvent(window, dragEventFor['end'], this.handleDragEnd);
475+
removeEvent(document, dragEventFor['move'], this.handleDrag);
476+
removeEvent(document, dragEventFor['end'], this.handleDragEnd);
477477
removeUserSelectStyles(this);
478478
},
479479

@@ -541,8 +541,8 @@ module.exports = React.createClass({
541541

542542

543543
// Add event handlers
544-
addEvent(window, dragEventFor['move'], this.handleDrag);
545-
addEvent(window, dragEventFor['end'], this.handleDragEnd);
544+
addEvent(document, dragEventFor['move'], this.handleDrag);
545+
addEvent(document, dragEventFor['end'], this.handleDragEnd);
546546
},
547547

548548
handleDragEnd: function (e) {
@@ -562,8 +562,8 @@ module.exports = React.createClass({
562562
this.props.onStop(e, createUIEvent(this));
563563

564564
// Remove event handlers
565-
removeEvent(window, dragEventFor['move'], this.handleDrag);
566-
removeEvent(window, dragEventFor['end'], this.handleDragEnd);
565+
removeEvent(document, dragEventFor['move'], this.handleDrag);
566+
removeEvent(document, dragEventFor['end'], this.handleDragEnd);
567567
},
568568

569569
handleDrag: function (e) {

0 commit comments

Comments
 (0)