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 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-07-13 05:03:31 +01:00
parent 1751f0534f
commit 8555661823
+8 -8
View File
@@ -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;