fix(modal): add fallback timer for mobile close animation
On mobile, closeModal() relies on the CSS animationend event to call _doClose(). When the animation does not fire (prefers-reduced-motion, tab switch, browser quirk), the modal stays stuck and the user cannot dismiss it. A 300ms fallback timer now guarantees cleanup runs. Reported in discussion #9
This commit is contained in:
@@ -264,7 +264,10 @@ export function closeModal() {
|
||||
const isMobile = window.innerWidth < 768;
|
||||
if (isMobile && panel) {
|
||||
panel.classList.add('modal-panel--closing');
|
||||
// Fallback-Timer falls animationend nicht feuert (prefers-reduced-motion, Tab-Wechsel etc.)
|
||||
const fallback = setTimeout(_doClose, 300);
|
||||
panel.addEventListener('animationend', () => {
|
||||
clearTimeout(fallback);
|
||||
_doClose();
|
||||
}, { once: true });
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user