-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix: web modals being closed unintentionally #6097
base: main
Are you sure you want to change the base?
Fix: web modals being closed unintentionally #6097
Conversation
This doesn't seem ideal as |
@mary-ext Appreciate your speedy response. What I've noticed, though, is when you press outside the modal, drag it inside the modal, and release, that still closes out the modal, which I think is probably okay. |
CleanShot.2024-11-03.at.23.53.57.mp4Here's the updated behavior. |
CleanShot.2024-11-04.at.00.12.20.mp4I've found this interesting behavior in the production build. The issue starts not happening once I drag from outside to inside. So, I think there is something more to investigate here, and I will keep posting my updates here. |
I am not 100% sure what's happening under the hood, but here are my findings.
Here is a visual explanation of what's described above - CleanShot.2024-11-04.at.10.40.34.mp4Here is my fix. My only concern with the fix is when case 2 happens without the selection, it still closes out the modal. @mary-ext If you can take another look, that would be appreciated. Thanks |
… close #6096 and close #6040
Description of the issue
The reproduction steps and details are well described in the linked issue. In addition to that, this issue is not specific to the custom domain modal but all modals on the web.
Root cause explained
The backdrop component is listening to
onPress
event and closes out the modal when it happens.But as described here,
onPress
event occurs afteronPressOut
event, which means it will occur whenever the mouse is pressed out on thePressable
component.And that's exactly what's happening in the current implementation. When you press the mouse inside the modal and drag it out to the backdrop component (
TouchableWithoutFeedback
), theonPress
event still occurs thus the modal disappears.Changes made in the PR
Replaced
onPress
withonPressIn
so the modal closes only when the mouse press event happens inside the backdrop (not the modal).Screen recording of the updated behavior
https://github.com/user-attachments/assets/df9bade5-fb0d-4027-a7ed-f3312f38d1ee