Skip to content

Commit a81251f

Browse files
committed
#2410: Further improve selection handling on drag start
1 parent ca13d2c commit a81251f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Sortable.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -715,16 +715,14 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
715715
}
716716

717717
try {
718-
if (this.nativeDraggable) {
718+
719+
if (document.selection) {
720+
_nextTick(() => {
721+
document.selection.empty();
722+
});
723+
} else if (this.nativeDraggable) {
719724
window.getSelection().removeAllRanges();
720725
}
721-
_nextTick(() => {
722-
if (document.selection) {
723-
document.selection.empty();
724-
} else if (!this.nativeDraggable) {
725-
window.getSelection().removeAllRanges();
726-
}
727-
});
728726
} catch (err) {
729727
}
730728
},
@@ -999,6 +997,8 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
999997

1000998
moved = true;
1001999

1000+
window.getSelection().removeAllRanges();
1001+
10021002
if (Safari) {
10031003
css(document.body, 'user-select', 'none');
10041004
}

0 commit comments

Comments
 (0)