diff --git a/src/components/git-panel/view/modals/ConfirmActionModal.tsx b/src/components/git-panel/view/modals/ConfirmActionModal.tsx index fff1eb45..78f8b048 100644 --- a/src/components/git-panel/view/modals/ConfirmActionModal.tsx +++ b/src/components/git-panel/view/modals/ConfirmActionModal.tsx @@ -1,3 +1,4 @@ +import { useEffect } from 'react'; import { Check, Download, Trash2, Upload } from 'lucide-react'; import { CONFIRMATION_ACTION_LABELS, @@ -30,6 +31,25 @@ function renderConfirmActionIcon(actionType: ConfirmationRequest['type']) { } export default function ConfirmActionModal({ action, onCancel, onConfirm }: ConfirmActionModalProps) { + const titleId = action ? `confirmation-title-${action.type}` : undefined; + + useEffect(() => { + if (!action) { + return; + } + + const handleKeyDown = (event: KeyboardEvent) => { + if (event.key === 'Escape') { + onCancel(); + } + }; + + window.addEventListener('keydown', handleKeyDown); + return () => { + window.removeEventListener('keydown', handleKeyDown); + }; + }, [action, onCancel]); + if (!action) { return null; } @@ -37,13 +57,20 @@ export default function ConfirmActionModal({ action, onCancel, onConfirm }: Conf return (
-
+
{renderConfirmActionIcon(action.type)}
-

{CONFIRMATION_TITLES[action.type]}

+

+ {CONFIRMATION_TITLES[action.type]} +

{action.message}