From 14fda259e6e65e3d1b6a4c6fdfc38b4e48699f75 Mon Sep 17 00:00:00 2001 From: tlkh40 <72644753+tlkh40@users.noreply.github.com> Date: Wed, 29 Jun 2022 18:49:57 +0700 Subject: [PATCH] fix: allow for prevent default in toast notification --- src/Notification/ToastNotification.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Notification/ToastNotification.svelte b/src/Notification/ToastNotification.svelte index ff60b6c7..715bb8e0 100644 --- a/src/Notification/ToastNotification.svelte +++ b/src/Notification/ToastNotification.svelte @@ -43,8 +43,10 @@ let timeoutId = undefined; function close(closeFromTimeout) { - open = false; - dispatch("close", { timeout: closeFromTimeout === true }); + const shouldContinue = dispatch("close", { timeout: closeFromTimeout === true }, { cancelable: true }); + if (shouldContinue) { + open = false; + } } onMount(() => {