diff --git a/delphi-backend/UMainForm.pas b/delphi-backend/UMainForm.pas index 95a4000..891cf31 100644 --- a/delphi-backend/UMainForm.pas +++ b/delphi-backend/UMainForm.pas @@ -921,8 +921,13 @@ begin end // cancel: JS found no match or user dismissed the picker — nothing to type. + // Hand the foreground back to the window the hotkey came from (Esc in the + // quick-search means "never mind, return me to where I was"). We're the + // foreground process at that moment, so plain SetForegroundWindow works. else if ACmd = 'autofill/cancel' then begin + if FAutofillTargetHWND <> 0 then + SetForegroundWindow(FAutofillTargetHWND); FAutofillTargetHWND := 0; LogLine('Autofill cancelled (no match or dismissed)'); end diff --git a/js/app.js b/js/app.js index 93fac4c..42b3f84 100644 --- a/js/app.js +++ b/js/app.js @@ -7964,6 +7964,10 @@ async function init() { const rows = document.querySelectorAll('#quickSearchResults .quick-search-row'); if (e.key === 'Escape') { e.preventDefault(); + // Kill the keystroke: without this the SAME Esc reaches the + // document-level handlers, which now see "no modal open" + // (we just closed it) and also close the dirty slideover. + e.stopPropagation(); closeQuickSearchModal(); } else if (e.key === 'ArrowDown') { e.preventDefault();