From 74969ae9686f5451c74170c44c8e26b38b0bfbf8 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 20 Nov 2025 23:29:57 +0800 Subject: [PATCH] fix(dialog): prevent dialogs from closing on overlay click Add onInteractOutside handler to DialogContent to prevent accidental dialog closure when users click on the overlay/backdrop. This prevents data loss in forms and improves user experience across all 11 dialog components in the application. Users can still close dialogs using: - Close button (X) in the top-right corner - Cancel/Close buttons within the dialog - ESC key --- src/components/ui/dialog.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx index 37cb41c..98a726f 100644 --- a/src/components/ui/dialog.tsx +++ b/src/components/ui/dialog.tsx @@ -59,6 +59,10 @@ const DialogContent = React.forwardRef< zIndexMap[zIndex], className, )} + onInteractOutside={(e) => { + // 防止点击遮罩层关闭对话框 + e.preventDefault(); + }} {...props} > {children}