bestguy / sveltestrap

Bootstrap 4 & 5 components for Svelte
https://sveltestrap.js.org
MIT License
1.3k stars 183 forks source link

Pressing escape can cause a closed modal to reopen #407

Closed lovasoa closed 2 years ago

lovasoa commented 2 years ago

There is a bug in the Modal component where the escape key event handler can be called even when the modal has been closed, causing it to reopen. This is because the event handler is not removed immediately in a synchronous manner when the modal is closed, and can be invoked multiple times.

You can see it on the official demo page by just opening the first modal, and pressing escape twice in a row quickly : https://sveltestrap.js.org/?path=/story/components--modals

bestguy commented 2 years ago

This is released in v5.7.0, thanks for the fix @lovasoa

lovasoa commented 2 years ago

Thanks for merging!