fix: three more bugs of the same classes (Esc fall-through, chord, placement)

Hunted the classes behind the recent quick-search fixes across the codebase:

- Esc priority: the command palette is .cmd-palette (not .modal), so the
  slideover's capture-phase Esc handler didn't see it and popped the
  discard-confirm UNDER the open palette. Capture handler now also yields
  to the palette.
- Esc fall-through: the fallback Esc branch closed palette + slideover +
  entry modal + generator ALL on one keystroke. Now closes exactly one
  surface per keystroke, topmost first.
- Modifier chord: the real-VK Tab between username and password becomes
  Shift+Tab if the user holds Shift mid-fill -> focus moves backward and
  the password lands in the username field. ForceReleaseModifiers before
  SendVKey(VK_TAB).
- Stale placement: RestoreFromTray replayed the MinimizeToTray snapshot for
  a merely taskbar-minimised window, teleporting it to the last tray-hide
  position. Snapshot now replays only on a genuine tray return (captured
  before Show flips Visible); iconic windows use Windows' own placement.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-07-12 22:46:42 +01:00
parent 3d217e82d4
commit bf606493bd
2 changed files with 38 additions and 8 deletions
+25 -7
View File
@@ -7222,6 +7222,10 @@ async function init() {
if (e.key !== 'Escape') return;
if (!$('#slideover').classList.contains('is-open')) return;
if (document.querySelector('.modal:not(.is-hidden)')) return;
// Command palette is .cmd-palette, not .modal — it sits on top of
// the editor, so its Esc must close IT (bubble handler), not pop
// the editor's discard-confirm underneath.
if (!$('#cmdPalette').classList.contains('is-hidden')) return;
// Settings panel takes priority — when both Settings AND the
// editor are open, the first Esc should close Settings (the
// thing the user just opened on top), the second Esc handles
@@ -7912,13 +7916,27 @@ async function init() {
closeHistoryModal();
return;
}
closePalette();
requestCloseSlideOver();
closeEntryModal();
closeGen();
// If nothing else needed dismissing and there's an active
// selection, clear it. Replaces the "click empty space to
// deselect" path that the marquee provided.
// 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;
}
if (!$('#genModal').classList.contains('is-hidden')) {
closeGen();
return;
}
if ($('#slideover').classList.contains('is-open')) {
requestCloseSlideOver();
return;
}
// Nothing else needed dismissing — clear an active selection.
// Replaces the "click empty space to deselect" marquee path.
if (state.checked.size > 0) {
state.checked.clear();
renderGrid();