From 8555661823a0a055ed24c89f39e69d387ecfbb3e Mon Sep 17 00:00:00 2001 From: r-zakarya <82443831+r-zakarya@users.noreply.github.com> Date: Mon, 13 Jul 2026 05:03:31 +0100 Subject: [PATCH] fix(esc): palette closes before the info modals it opens over Cheatsheet open -> Ctrl+K -> Esc closed the cheatsheet UNDER the palette: the priority chain tested cheatsheet/history before cmdPalette. Palette now sits right after confirmModal (still the absolute top) in the one-surface- per-keystroke chain. Co-Authored-By: Claude Opus 4.8 --- js/app.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/js/app.js b/js/app.js index 578ebc7..92bea24 100644 --- a/js/app.js +++ b/js/app.js @@ -7923,11 +7923,18 @@ async function init() { e.preventDefault(); openCheatsheet(); } else if (e.key === 'Escape') { - // Close in priority order: confirm first (most modal-y) then others + // Close in priority order: confirm first (most modal-y), then the + // palette — it OPENS OVER the info modals (Ctrl+K on top of the + // cheatsheet), so it must close before them. ONE surface per + // keystroke, topmost first. if (!$('#confirmModal').classList.contains('is-hidden')) { closeConfirm(false); return; } + if (!$('#cmdPalette').classList.contains('is-hidden')) { + closePalette(); + return; + } if (!$('#changeMasterModal').classList.contains('is-hidden')) { closeChangeMasterModal(); return; @@ -7940,13 +7947,6 @@ async function init() { closeHistoryModal(); return; } - // ONE surface per keystroke, topmost first — closing several at - // once meant "Esc closes the palette AND pops the editor's - // discard prompt" (same class as the quick-search Esc bug). - if (!$('#cmdPalette').classList.contains('is-hidden')) { - closePalette(); - return; - } if (!$('#entryModal').classList.contains('is-hidden')) { closeEntryModal(); return;