From 22d3209fc6a27f726441a7d0e8c3a0dcd0d76c78 Mon Sep 17 00:00:00 2001 From: v0 Date: Wed, 4 Feb 2026 16:21:49 +0000 Subject: [PATCH] fix: prevent toast interaction from affecting dialog Add event stopping to Toast root and close button to prevent leaks Co-authored-by: Simon <85533298+handsomezhuzhu@users.noreply.github.com> --- components/ui/toast.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/components/ui/toast.tsx b/components/ui/toast.tsx index de90680..bdfbb62 100644 --- a/components/ui/toast.tsx +++ b/components/ui/toast.tsx @@ -44,11 +44,19 @@ const Toast = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & VariantProps ->(({ className, variant, ...props }, ref) => { +>(({ className, variant, onPointerDown, onMouseDown, ...props }, ref) => { return ( { + e.stopPropagation() + onPointerDown?.(e) + }} + onMouseDown={(e) => { + e.stopPropagation() + onMouseDown?.(e) + }} {...props} /> ) @@ -82,9 +90,17 @@ const ToastClose = React.forwardRef< )} toast-close="" onClick={(e) => { + e.preventDefault() e.stopPropagation() + e.nativeEvent.stopImmediatePropagation() onClick?.(e) }} + onPointerDown={(e) => { + e.stopPropagation() + }} + onMouseDown={(e) => { + e.stopPropagation() + }} {...props} >