-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Modal closing when clicking on content inside it #229
Comments
A possible solution could be to attach an on:click to the innerModal div that sets a flag to inhibit the close action. Code snippet:
By doing this, events that propagated from a child of innerModal will set the flag to true (even if unmounted, because the bubbling flow is preserved). Moreover this should be faster than calling |
I saw your PR that fixes this behavior for the PasswordInput component, but I should have probably hightlighted the
part. Sorry if I didn't express myself clearly enough in the original post. Thanks |
@cdellacqua interesting solution – will give it a try. |
@cdellacqua your solution is brilliant.
|
@cdellacqua Fixed in v0.9.5 |
Perfect! Thanks a lot for your time, I'm really appreciating this library. Closing the issue |
I'm using a modal containing a form with a PasswordInput field. When clicking the show/hide password, the modal closes unexpectedly. I found out after some debugging that the problem is here:
(file Modal.svelte)
By clicking the "hide/show" icon inside the PasswordInput, that icon gets unmounted from the DOM so it can be replaced with another one indicating the opposite action. That causes the
.contains
method to return false, even though the source of the event was inside the modal when it was originally triggered. This should also apply to similar cases.The text was updated successfully, but these errors were encountered: