-
-
Notifications
You must be signed in to change notification settings - Fork 621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Update scroll ancestor detection when the draggable is not over a droppable #54
Conversation
|
Size Change: +424 B (+1%) Total Size: 62.9 kB
ℹ️ View Unchanged
|
Hi @clauderic 👋 Love your library, huge work! This PR concerns the Sortable preset as well? |
Hey @py-wai, the sortable preset is built on top of |
@clauderic thank you for the fantastic library and great support. I have faced similar issues to #43, and I am happy to try and help solve this. I am slowly learning the inner workings of this library, so is there any way I can help with this PR? |
Closing in favor of #518 |
This PR is currently a work in progress, but will eventually resolve #43.
Currently, if the active draggable is not over a droppable, the scroll ancestor logic assumes that the scroll ancestors should be those of the active draggable.
This behaviour is problematic for a number of reasons, including those outlined in #43.
An alternative approach that I'm exploring in this PR is to find the scroll element automatically based on the center point of the active draggable. This isn't a perfect solution, which is why I'm opening this PR as a draft PR for the time being.
This solution isn't perfect currently because the point coordinates used for scroll ancestor detection should be affected by modifiers, but the modifiers also need the scroll ancestors. One solution for this that I'm currently thinking of would be to distinguish between the scroll target ancestors and the active node scroll ancestors.
Also, the
document.getElementFromPoint
method is expensive, and therefore calls to it should be debounced to avoid performance issues. Finding a scroll ancestor when the draggable is not over a droppable is something that can be done asynchronously and doesn't necessarily need to happen immediately for every drag move event.