From ff56f04b2e38d17efe7168f9cc9d7faeaf9761f9 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Thu, 13 Jul 2023 15:21:28 +0530 Subject: [PATCH] chore: allow click-to-dismiss on toasts with actions --- packages/toast/src/Toast.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/toast/src/Toast.tsx b/packages/toast/src/Toast.tsx index b1721c68a..8a7e8b0e4 100644 --- a/packages/toast/src/Toast.tsx +++ b/packages/toast/src/Toast.tsx @@ -84,7 +84,7 @@ export const Toast = forwardRef(({ toast, index }: Props, ref: ForwardedRef { - if (!hasActions && toast.type !== ToastType.Loading && toast.type !== ToastType.Progress) { + if (toast.type !== ToastType.Loading && toast.type !== ToastType.Progress) { dismissToast(toast.id) } }} @@ -104,7 +104,9 @@ export const Toast = forwardRef(({ toast, index }: Props, ref: ForwardedRef { + onClick={(event) => { + event.preventDefault() + event.stopPropagation() action.handler(toast.id) }} key={index}