Skip to content
This repository was archived by the owner on Jun 18, 2018. It is now read-only.

Commit bb6bfe0

Browse files
committed
Prefer selection to dragging in IE for editable elements
Fixes #13
1 parent f3ced55 commit bb6bfe0

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

src/HTML5Backend.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,27 @@ export default class HTML5Backend {
494494
}
495495

496496
handleSelectStart(e) {
497-
// Prevent selection on IE
498-
// and instead ask it to consider dragging.
499-
if (typeof e.target.dragDrop === 'function') {
500-
e.preventDefault();
501-
e.target.dragDrop();
497+
const { target } = e;
498+
499+
// Only IE requires us to explicitly say
500+
// we want drag drop operation to start
501+
if (typeof target.dragDrop !== 'function') {
502+
return;
502503
}
504+
505+
// Inputs and textareas should be selectable
506+
if (
507+
target.tagName === 'INPUT' ||
508+
target.tagName === 'SELECT' ||
509+
target.tagName === 'TEXTAREA' ||
510+
target.isContentEditable
511+
) {
512+
return;
513+
}
514+
515+
// For other targets, ask IE
516+
// to enable drag and drop
517+
e.preventDefault();
518+
target.dragDrop();
503519
}
504520
}

0 commit comments

Comments
 (0)