From a9e56c52b58010074fe043fc46236f72c398077a Mon Sep 17 00:00:00 2001 From: r-zakarya <82443831+r-zakarya@users.noreply.github.com> Date: Mon, 27 Jul 2026 21:11:43 +0100 Subject: [PATCH] fix(autofill): send the window back to the tray when the picker is dismissed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cancelling left the window on the desktop, though it had only been restored to ask which entry to fill. Quick-search already hides itself on Esc; this makes the picker symmetric. Applies to all three hotkeys — the capture and the hide both sit on the shared BridgeAutofillRequest / autofill/cancel paths, so full, password-only and TOTP behave identically. Co-Authored-By: Claude Opus 5 --- TEST_SCENARIOS.md | 2 +- delphi-backend/UMainForm.pas | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/TEST_SCENARIOS.md b/TEST_SCENARIOS.md index 8eeb6f4..91aba4f 100644 --- a/TEST_SCENARIOS.md +++ b/TEST_SCENARIOS.md @@ -313,7 +313,7 @@ l'éditeur slideover : créer + éditer une entrée, ajouter/retirer des tags, ### H9 · retour au tray après un pick dans le picker ✅ - **ACTION** : app **au tray** → `Ctrl+Shift+L` depuis une autre app sur un titre à plusieurs candidats → le picker sort la fenêtre du tray → choisir une entrée. - **ATTENDU** : le remplissage se fait puis l'app **repart au tray**, comme elle est venue. -- **Variantes** : match unique (pas de picker) → reste au tray ; app déjà visible → reste visible ; app **minimisée dans la barre des tâches** → n'est **pas** envoyée au tray (`not Self.Visible` est faux pour une fenêtre iconique) ; picker fermé sans choisir → l'app reste où elle est et le hotkey suivant n'hérite pas de l'état capturé. +- **Variantes** : match unique (pas de picker) → reste au tray ; app déjà visible → reste visible ; app **minimisée dans la barre des tâches** → n'est **pas** envoyée au tray (`not Self.Visible` est faux pour une fenêtre iconique) ; picker fermé par Esc sans choisir → l'app **repart au tray** elle aussi (symétrique de quick-search, qui se cache sur Esc) et le hotkey suivant n'hérite pas de l'état capturé. - **Historique** : seul le chemin quick-search capturait « était cachée » (`LWasHidden`) et le faisait remonter via `hide_after` ; JS n'envoie jamais ce paramètre depuis le picker d'autofill, donc l'app restait sur le bureau. Capturé désormais côté Delphi dans `BridgeAutofillRequest`, au moment du hotkey — après, le picker a déjà détruit l'information. ### H7 · combo déjà pris par une autre application ✅ diff --git a/delphi-backend/UMainForm.pas b/delphi-backend/UMainForm.pas index 8d2b0e0..c8789d0 100644 --- a/delphi-backend/UMainForm.pas +++ b/delphi-backend/UMainForm.pas @@ -1087,9 +1087,14 @@ begin if FAutofillTargetHWND <> 0 then SetForegroundWindow(FAutofillTargetHWND); FAutofillTargetHWND := 0; - // Cancelled: the window stays wherever the user left it, and the captured - // state must not leak into the next hotkey. - FAutofillHotkeyWasHidden := False; + // 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 + begin + FAutofillHotkeyWasHidden := False; + FBridge.MinimizeToTray; + end; LogLine('Autofill cancelled (no match or dismissed)'); end