-
-
Notifications
You must be signed in to change notification settings - Fork 656
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
Prevent dragging element when interacting with its children elements #827
Comments
Hey,
It doesn’t matter—that’s how event bubbling works through portals in a React tree, and here’s the relevant thread (facebook/react#11387) if you want to read the whole thing. Take a look at this solution; adding event handlers to the |
@awgv It works, thank you! |
Just saw this issue too, after ending up on that react issue, after I opened a very similar issue in this repo: Not sure if that workaround with stopPropagating directly inside the portal is good enough for us, because we don't have direct access to the Portal instance, since the modal is from a library too. But I will certainly check out what options we have, something similar on a lower level might work for us too. |
I was able to solve the problem by stopping the |
I solved it like that
|
This does not work for me @danylo-holovenko <motion.section |
Is there any way to prevent element dragging while interacting with its content? It's strange because the Modal component is a portal, which means it's not inside the draggable element's DOM.
If I move the modal outside the draggable component it works fine, but due to project structure it is required that the modal should be inside the draggable component
Example: https://codesandbox.io/s/dnd-kit-portaled-input-forked-kfskb8?file=/src/SortableItem.js
Screen.Recording.2022-07-11.at.14.25.22.mov
Thank you!
The text was updated successfully, but these errors were encountered: