Skip to content

Commit

Permalink
fix: remove selectstart event handler (#63)
Browse files Browse the repository at this point in the history
* fix: remove selectstart event handler

* fix: less hacky way for legacy IEs
  • Loading branch information
jasonslyvia committed Aug 9, 2016
1 parent c867850 commit 9e57941
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/SortableItemMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ function handleSortableItemReadyToMove(e) {
function handleComponentDidMount() {
const node = ReactDOM.findDOMNode(this);

on(node, 'selectstart', (e) => {
if (e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false;
}
});
// Prevent odd behaviour in legacy IE when dragging
if (window.attachEvent && !document.body.style['-ms-user-select']) {
on(node, 'selectstart', (e) => {
if (e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false;
}
});
}

if (isFunction(this.props.onSortableItemMount)) {
this.props.onSortableItemMount(position(node),
Expand Down

0 comments on commit 9e57941

Please sign in to comment.