fix(quick-search): Esc closes only the modal; cancel returns focus to target
- The qsInput Esc handler didn't stopPropagation, so the SAME keystroke fell through to the document-level Esc handlers which, seeing the modal now closed, also closed (or discard-prompted) the dirty slideover behind it. - autofill/cancel now hands the foreground back to the saved target HWND: Esc after a fill-mode hotkey returns the user to the window they came from instead of leaving our app focused. Locked-vault path still ends focused on us (cancelAutofill runs before focusApp). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -921,8 +921,13 @@ begin
|
|||||||
end
|
end
|
||||||
|
|
||||||
// cancel: JS found no match or user dismissed the picker — nothing to type.
|
// 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
|
else if ACmd = 'autofill/cancel' then
|
||||||
begin
|
begin
|
||||||
|
if FAutofillTargetHWND <> 0 then
|
||||||
|
SetForegroundWindow(FAutofillTargetHWND);
|
||||||
FAutofillTargetHWND := 0;
|
FAutofillTargetHWND := 0;
|
||||||
LogLine('Autofill cancelled (no match or dismissed)');
|
LogLine('Autofill cancelled (no match or dismissed)');
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7964,6 +7964,10 @@ async function init() {
|
|||||||
const rows = document.querySelectorAll('#quickSearchResults .quick-search-row');
|
const rows = document.querySelectorAll('#quickSearchResults .quick-search-row');
|
||||||
if (e.key === 'Escape') {
|
if (e.key === 'Escape') {
|
||||||
e.preventDefault();
|
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();
|
closeQuickSearchModal();
|
||||||
} else if (e.key === 'ArrowDown') {
|
} else if (e.key === 'ArrowDown') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user