dnd-kit icon indicating copy to clipboard operation
dnd-kit copied to clipboard

Wrong delta.y if no height is set, in multiple useDroppable

Open soplanstudio opened this issue 3 years ago • 6 comments

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

soplanstudio avatar Jul 30 '21 20:07 soplanstudio

I found out that the problem actually occurs when the page has the scroll...

soplanstudio avatar Aug 06 '21 19:08 soplanstudio

I'm not really sure what you're trying to achieve, would you be able to provide more information?

clauderic avatar Aug 25 '21 17:08 clauderic

@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.

Maetes avatar Aug 24 '22 13:08 Maetes

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.

rossmeredith avatar Jun 20 '23 18:06 rossmeredith