Skip to content

Commit 1cc3807

Browse files
committed
Draggable: Ensure correct widget removes helper in connectToSortable
1 parent c7bec85 commit 1cc3807

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

ui/draggable.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,13 +729,16 @@ $.ui.plugin.add("draggable", "connectToSortable", {
729729
item: inst.element
730730
});
731731

732+
inst.cancelHelperRemoval = false;
733+
732734
$.each(inst.sortables, function() {
733735
if (this.instance.isOver) {
734736

735737
this.instance.isOver = 0;
736738

737-
inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
738-
this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
739+
// Allow this sortable to handle removing the helper
740+
inst.cancelHelperRemoval = true;
741+
this.instance.cancelHelperRemoval = false;
739742

740743
//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: "valid/invalid"
741744
if (this.shouldRevert) {
@@ -755,7 +758,11 @@ $.ui.plugin.add("draggable", "connectToSortable", {
755758
left: ""
756759
});
757760
} else {
758-
this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
761+
// Prevent this Sortable from removing the helper.
762+
// However, don't set the draggable to remove the helper
763+
// either as another connected Sortable may yet handle the removal.
764+
this.instance.cancelHelperRemoval = true;
765+
759766
this.instance._trigger("deactivate", event, uiSortable);
760767
}
761768

0 commit comments

Comments
 (0)