clauderic / dnd-kit

The modern, lightweight, performant, accessible and extensible drag & drop toolkit for React.
http://dndkit.com
MIT License
12.71k stars 632 forks source link

Unable to drag item backwards (Sandbox available) #1392

Closed samkingtwentytwo closed 4 months ago

samkingtwentytwo commented 5 months ago

Hi guys, my handleDragOver function seems to be working fine, apart from when i drag the item backwards after going in one direction, it jumps an extra one each time. Been working on this for ages :(

https://codesandbox.io/p/devbox/kanban-3wq44f?file=%2Fapp%2Fpage.jsx

Much appreciated in advance!

VladimirAfanasievFS commented 4 months ago

Hi. Id should match with itemsIds

<SortableContext items={column.taskIds.map((id) => task-${id})}>

https://docs.dndkit.com/presets/sortable/usesortable#identifier

samkingtwentytwo commented 4 months ago

!!!!!!!!!!!!!!!!!!!!!!!! MY GUY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

THANKYOU SO MUCH!!!

You have saved weeks of trial and tribulation!

Thankyou my friend.