diff --git a/js/app.js b/js/app.js index a17d1c9..a18b30f 100644 --- a/js/app.js +++ b/js/app.js @@ -6979,9 +6979,15 @@ function installCustomContextMenu() { document.addEventListener('mousedown', ev => { if (!ev.target.closest('.custom-ctxmenu')) hide(); }); + // Capture + stopPropagation: Esc with the menu open must close ONLY the + // menu — otherwise the same keystroke reaches the slideover/fallback + // handlers and also closes (or discard-prompts) whatever is behind. document.addEventListener('keydown', ev => { - if (ev.key === 'Escape') hide(); - }); + if (ev.key !== 'Escape') return; + if (menu.classList.contains('is-hidden')) return; + ev.stopPropagation(); + hide(); + }, true); window.addEventListener('blur', hide); }