From b52ee4012d13e2f531a39fe0a53366e119dd1501 Mon Sep 17 00:00:00 2001 From: Michał Gołębiowski-Owczarek Date: Mon, 15 Nov 2021 18:39:25 +0100 Subject: Sortable: Fix positioning when moving a Draggable item into a Sortable PR gh-1793 removed setting `this.offset.parent` in the Draggable `refreshPositions` method which broke position calculations when moving a Draggable item into a connected Sortable. restore that assignment. Ref gh-1793 Fixes gh-2001 Closes gh-2009 --- ui/widgets/sortable.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ui') diff --git a/ui/widgets/sortable.js b/ui/widgets/sortable.js index 37ce4b7bb..f5dc5ecce 100644 --- a/ui/widgets/sortable.js +++ b/ui/widgets/sortable.js @@ -885,6 +885,12 @@ return $.widget( "ui.sortable", $.ui.mouse, { this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) : false; + // This has to be redone because due to the item being moved out/into the offsetParent, + // the offsetParent's position will change + if ( this.offsetParent && this.helper ) { + this.offset.parent = this._getParentOffset(); + } + this._refreshItemPositions( fast ); var i, p; -- cgit v1.2.3