react-sortablejs
react-sortablejs copied to clipboard
[bug] Swap plugin swaps incorrect item
Describe the bug When using the swap plugin, depending on which items you drag, the dragged element will swap to an incorrect position.
I created an example here: https://codesandbox.io/s/determined-sinoussi-knbno
To Reproduce Steps to reproduce the behavior:
- Start dragging shrek
- Drag him to "Ralf" and release
Expected behavior I expected "ralf" to be in position 1, and "shrek" to have replaced "ralf" between "fiona" and "stina". Instead, "shrek" ends up under "fiona" and "stina", one position too far.
However, if i swap "shrek" (position 1), for "eddie" (last position), it will swap correctly, and the other way around.
Information I this has existed for a while and that there is another ticket, but its a pretty huge bug for the swap plugin and i think it should be highlighted again.
Versions - Look in your package.json for this information:
react-sortable = ^5.0.5
react = ^16.13.1
sortablejs=1.12.0
Additional context Add any other context about the problem here.
Please provide examples, screenshots or a code sandbox for faster resolution times.
I have a work around for this. to use until it works as intended again https://github.com/SortableJS/react-sortablejs/issues/123#issuecomment-746250750