diff --git a/.changeset/sortable-group-aniamtion.md b/.changeset/sortable-group-aniamtion.md new file mode 100644 index 00000000..d876ec43 --- /dev/null +++ b/.changeset/sortable-group-aniamtion.md @@ -0,0 +1,5 @@ +--- +'@dnd-kit/dom': patch +--- + +Allow sortable animations when changing to a different group even when the index remains the same. diff --git a/packages/dom/src/sortable/sortable.ts b/packages/dom/src/sortable/sortable.ts index d459e78d..e75b8d98 100644 --- a/packages/dom/src/sortable/sortable.ts +++ b/packages/dom/src/sortable/sortable.ts @@ -131,20 +131,13 @@ export class Sortable { () => { const {index, group, previousIndex, manager: _} = this; - if (group !== previousGroup) { - previousGroup = group; + // Re-run this effect whenever the index changes + if (index !== previousIndex || group !== previousGroup) { this.previousIndex = index; - return; - } + previousGroup = group; - // Re-run this effect whenever the index changes - if (index === previousIndex) { - return; + this.animate(); } - - this.previousIndex = index; - - this.animate(); }, () => { const {target} = this;