Open H4JUN opened 4 months ago
I have the exact same problem when the list is in a dialog that can be moved around. So basically transform
gets the x and y values from the previous origin, so first interaction will have those x and y, and the next one(s) will be correct. For me setting transform.x
doesn't work fully as I can also move the dialog vertically so the items would move a bit more or less vertically... I am wondering if there is some other way of fixing this weird behavior?
I think it's the same issue as https://github.com/clauderic/dnd-kit/issues/615
in my case, I tried with the solution of #615 but it did not help. What we did since ours was a vertical list, was to set transform.x
to 0 and transform.y
to the height of the element.
https://github.com/clauderic/dnd-kit/assets/74544822/78e82406-39a9-41f2-9351-7f1f1d3a3f56
Link to codesandbox
Steps to reproduce:
Upon logging the
transform
value obtained from useSortable hook in theSortableListItem
, I get an Object with thex
property set to a value (199.23332214, the value changes everytime) when it should be set to zero.As a temporary workaround, I have manually set
transform.x
to be 0, given that my sortable list is a vertical list. However, if anyone comes up with a horizontal sortable list when its parent/ancestor has an animation that transforms on the x-axis, or a vertical list with animation on y-axis, then I think it cannot be bypassed that easily.Am I missing something from the documentation or did I do anything wrong in my code? Or is this an issue that needs to be addressed?