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
[bug]: closing dialog by click the dialog overlay will trigger click event by the parent #3600
Comments
Hi bao-io I found a solution for your issue, you almost solve it by passing the Here is what you need to do: In your Dialog Component adjust it to stop Propagation for DialogOverlay element:
I hope it works for you! |
Thank you for your reply, I have tried your solution and it can indeed solve my problem, but you can see that on the mobile end, its mask cannot be closed by clicking |
Indeed, the issue due to the additional events the mobile might use such as the "Touch Events". I would suggest another approach which is to pass the "Close Function", e.g.
As you see, I've passed the close function to handle the close of the dialog if it was provided, and completely ignore the
Please note that you have to also handle the case when the user click the "X" button to close the dialog or when the user click inside the dialog as well. Cheers! |
yeah, your idea is so wonderfull, but i think this
Thank you again for your reply,your idea is so wonderfull, but I don't think this idea is a long-term solution. I know that masks are closed through event bubbles, but under normal circumstances, this should not happen. This should be a bug in radixui |
Describe the bug
I have already blocked the bubble of the event with the button. Why does it trigger the parent click event when closing the pop-up window
Affected component/components
Dialog
How to reproduce
Codesandbox/StackBlitz link
No response
Logs
No response
System Info
Before submitting
The text was updated successfully, but these errors were encountered: