Closed
Description
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)
on:click={({ target }) => {
if (!innerModal.contains(target)) {
open = false;
}
}}
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.