From 1e6426ed4f9f34c8c6cfecffaa6d305b6bb7fec5 Mon Sep 17 00:00:00 2001 From: silentoplayz Date: Sun, 12 Oct 2025 05:52:24 -0400 Subject: [PATCH] fix: allow toast notifications to be closed when a modal is open The focus trap in the modal component was preventing clicks on elements outside of the modal, including the notification toasts. This change configures the focus trap to allow clicks on toast notifications, so they can be dismissed even when a modal is open. --- src/lib/components/common/Modal.svelte | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/components/common/Modal.svelte b/src/lib/components/common/Modal.svelte index 1d4e8c536a..23006c1762 100644 --- a/src/lib/components/common/Modal.svelte +++ b/src/lib/components/common/Modal.svelte @@ -57,7 +57,11 @@ $: if (show && modalElement) { document.body.appendChild(modalElement); - focusTrap = FocusTrap.createFocusTrap(modalElement); + focusTrap = FocusTrap.createFocusTrap(modalElement, { + allowOutsideClick: (e) => { + return e.target.closest('[data-sonner-toast]') !== null; + } + }); focusTrap.activate(); window.addEventListener('keydown', handleKeyDown); document.body.style.overflow = 'hidden';