react-sortablejs icon indicating copy to clipboard operation
react-sortablejs copied to clipboard

[bug] Swap plugin swaps incorrect item

Open ralcar opened this issue 5 years ago • 1 comments

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:

  1. Start dragging shrek
  2. 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.

ralcar avatar Sep 26 '20 17:09 ralcar

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

kevinbevers avatar Dec 16 '20 13:12 kevinbevers