fix(autofill): refusing a request must not move any window
The busy guard cancelled through the path that hands the foreground back to the captured target. During an export that pushed the native Save dialog behind the other application, leaving the app disabled by a modal the user could no longer find. refocus=0 separates refusing a request from ending a user interaction.
This commit is contained in:
@@ -1093,13 +1093,18 @@ begin
|
||||
// foreground process at that moment, so plain SetForegroundWindow works.
|
||||
else if ACmd = 'autofill/cancel' then
|
||||
begin
|
||||
if FAutofillTargetHWND <> 0 then
|
||||
// refocus=0 — JS is REFUSING the request, not ending a user interaction:
|
||||
// nothing must move on screen. During an export a native Save dialog owns
|
||||
// the foreground, and pushing it behind leaves the app disabled by a modal
|
||||
// the user can no longer find.
|
||||
var LRefocus := GetParam('refocus') <> '0';
|
||||
if LRefocus and (FAutofillTargetHWND <> 0) then
|
||||
SetForegroundWindow(FAutofillTargetHWND);
|
||||
FAutofillTargetHWND := 0;
|
||||
// The window only came out of the tray to show the picker, so dismissing it
|
||||
// puts it back — same as quick-search, which hides on Esc too. Done after
|
||||
// handing focus to the target above.
|
||||
if FAutofillHotkeyWasHidden then
|
||||
if FAutofillHotkeyWasHidden and LRefocus then
|
||||
begin
|
||||
FAutofillHotkeyWasHidden := False;
|
||||
// Foreground already handed to the target above.
|
||||
|
||||
Reference in New Issue
Block a user