dnd-kit icon indicating copy to clipboard operation
dnd-kit copied to clipboard

Vertical Sortable List: wrong height calculation on reorder

Open nachodeh opened this issue 1 year ago • 0 comments

Scenario

  • Vertical list
  • Items of variable height
  • Items are Sortable
  • Using DragOverlay

Problem

  • We have items 1, 2 and 3, they just have texts. Item 2 text is much longer than the other items.
  • When reordering item 1 below item 2, the height calculation is wrong
  • Item 2 shifts to Item 1 position but instead of using it's actual height, it only occupies Item 1 height
  • In some scenarios, this means Item 1 gets hidden behind Item 2 when trying to reorder.

Code Sandbox

https://codesandbox.io/p/sandbox/immutable-sea-55msrd?file=%2Fsrc%2FApp.tsx

nachodeh avatar Aug 30 '24 13:08 nachodeh