From e38b087ff6b449ec9d65b13a2f58dd4139f9d424 Mon Sep 17 00:00:00 2001 From: Adam Shiervani Date: Mon, 13 Oct 2025 17:09:10 +0200 Subject: [PATCH] Close Modals on Escape --- ui/src/components/ConfirmDialog.tsx | 77 ++++++++++++++++------------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/ui/src/components/ConfirmDialog.tsx b/ui/src/components/ConfirmDialog.tsx index d302ead6..9cd9c9ba 100644 --- a/ui/src/components/ConfirmDialog.tsx +++ b/ui/src/components/ConfirmDialog.tsx @@ -67,46 +67,55 @@ export function ConfirmDialog({ }: ConfirmDialogProps) { const { icon: Icon, iconClass, iconBgClass, buttonTheme } = variantConfig[variant]; + const handleKeyDown = (e: React.KeyboardEvent) => { + if (e.key === "Escape") { + e.stopPropagation(); + onClose(); + } + }; + return ( - -
-
-
-
-
-
-
-

- {title} -

-
- {description} +
+ +
+
+
+
+
+
+
+

+ {title} +

+
+ {description} +
-
-
- {cancelText && ( - - )} -
-
- + +
); }