dnd-kit
dnd-kit copied to clipboard
Wrong delta.y if no height is set, in multiple useDroppable
when the useDroppable has a height defined by an image, delta.y seems to return wrong in the second useDroppable
forgive me if something is missing, i have been looking for the solution and i have not found it anywhere
https://codesandbox.io/s/sweet-water-4mzhh?file=/src/App.js
I found out that the problem actually occurs when the page has the scroll...
I'm not really sure what you're trying to achieve, would you be able to provide more information?
@soplanstudio it seems I triggered the same issue.
Let me describe it to you @clauderic : I have a drawer with an accordion on the left side of my page. Within the accordion we have 100 items which trigger the drawer to be scrollable, when I want to grab the last item. So when I drag this item to my dropable, the delta.top param of the event.delta.y prop shows a weird number for example of -2000px. That's why the delta put the scrolled Drawer in its calculation, but it shouldn't.
I think I've encountered this. My droppable area is a scrollable container and when scrollTop is greater than zero the delta.y given to me in onDragEnd includes the scrollTop value. It seems therefore the calculation is using pageY instead of clientY (i.e. relative to the document instead of the viewport as I was expecting). Am I wrong to expect it to be relative to the viewport? I couldn't find anything in the docs.