Skip to content

Commit 27ed207

Browse files
committed
Draggable: Ensure css is always restored after connectToSortable drag
Fixes #9675
1 parent 1cc3807 commit 27ed207

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

ui/draggable.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -744,19 +744,20 @@ $.ui.plugin.add("draggable", "connectToSortable", {
744744
if (this.shouldRevert) {
745745
this.instance.options.revert = this.shouldRevert;
746746
}
747+
// Use _storedCSS To restore properties in the sortable,
748+
// as this also handles revert (#9675) since the draggable
749+
// may have modified them in unexpected ways (#8809)
750+
this.instance._storedCSS = {
751+
position: this.instance.placeholder.css( "position" ),
752+
top: this.instance.placeholder.css( "top" ),
753+
left: this.instance.placeholder.css( "left" )
754+
};
747755

748756
//Trigger the stop of the sortable
749757
this.instance._mouseStop(event);
750758

751759
this.instance.options.helper = this.instance.options._helper;
752760

753-
// restore properties in the sortable, since the draggable may have
754-
// modified them in unexpected ways (#8809)
755-
this.instance.currentItem.css({
756-
position: this.instance.placeholder.css( "position" ),
757-
top: "",
758-
left: ""
759-
});
760761
} else {
761762
// Prevent this Sortable from removing the helper.
762763
// However, don't set the draggable to remove the helper

0 commit comments

Comments
 (0)