Skip to content

Commit

Permalink
#2410: Further improve selection handling on drag start
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-m1 committed Nov 27, 2024
1 parent ca13d2c commit a81251f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,16 +715,14 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
}

try {
if (this.nativeDraggable) {

if (document.selection) {
_nextTick(() => {
document.selection.empty();
});
} else if (this.nativeDraggable) {
window.getSelection().removeAllRanges();
}
_nextTick(() => {
if (document.selection) {
document.selection.empty();
} else if (!this.nativeDraggable) {
window.getSelection().removeAllRanges();
}
});
} catch (err) {
}
},
Expand Down Expand Up @@ -999,6 +997,8 @@ Sortable.prototype = /** @lends Sortable.prototype */ {

moved = true;

window.getSelection().removeAllRanges();

if (Safari) {
css(document.body, 'user-select', 'none');
}
Expand Down

0 comments on commit a81251f

Please sign in to comment.