Open sspilleman opened 1 year ago
If you have that specific need why not to set dismissable={false}
and add your own CloseButton
?
<Modal bind:open>
<div slot="header" class="flex items-center">
<h3>My title</h3>
<CloseButton on:click={()=> open=false} />
</div>
... rest of the modal content ...
</Modal>
That is what I'm planning to do... but I think that is a workaround, not a real solution... I then need to think about positioning etc
Keyboard users expect the Esc key to close modal dialogs; ensure that this behavior is implemented and maintained.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
So, it is not recommended to prevent using the Escape button if you find accessibility important enough.
Summary
Currently there is the "dismissable" prob. That is controlling 2 results:
I would like to have the ability to still have the close button but not enable dismissing with the escape key.
Motivation
User might press "Escape" accidentally, thus closing the Modal, which might not be what you want in all cases