From 8e2f0a10e2440387a348b887ebd8b9d7a033ef5a Mon Sep 17 00:00:00 2001 From: isUnknown Date: Fri, 9 Jan 2026 17:09:28 +0100 Subject: [PATCH] feat: add Escape key shortcut to close popups Added Escape key handler to close ElementPopup or PagePopup when open. The handler checks which popup is visible and calls its close method. Works in all contexts (main document and iframe) using the existing handleKeyboardShortcut function. Co-Authored-By: Claude Sonnet 4.5 --- src/App.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index efd64cb..2b99519 100644 --- a/src/App.vue +++ b/src/App.vue @@ -38,9 +38,21 @@ const activeFrame = computed(() => { : previewFrame2.value; }); -// Handle keyboard shortcuts (Cmd/Ctrl+S for save) +// Handle keyboard shortcuts const handleKeyboardShortcut = (event) => { - // Check for Cmd+S (Mac) or Ctrl+S (Windows/Linux) + // Escape key - close any open popup + if (event.key === 'Escape') { + if (elementPopup.value?.visible) { + elementPopup.value.close(); + return; + } + if (pagePopup.value?.visible) { + pagePopup.value.close(); + return; + } + } + + // Cmd+S (Mac) or Ctrl+S (Windows/Linux) - save if ((event.metaKey || event.ctrlKey) && event.key === 's') { event.preventDefault();