fix(autofill): force-release stuck modifiers; balloon when blocked from tray

Root cause of "Ctrl+Shift+P opened the new-entry modal": if the user still
holds Ctrl+Shift when WaitForModifierRelease times out (1s), every password
letter is typed as a Ctrl+Shift+<letter> chord — garbage in the field AND it
fires our own global hotkeys (a password containing 'a' triggers Ctrl+Shift+A
= new entry). ForceReleaseModifiers now injects KEYUP for any still-held
modifier before typing.

Also: when the fill is blocked (elevated target) while the window is hidden
in the tray, the in-app toast is invisible — show a tray balloon instead.
ShowFirstTimeBalloon generalized into ShowBalloon(title, text, warning),
gated by the existing "Show tray notifications" setting.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-07-12 05:08:50 +01:00
parent b869effee5
commit aab0b14be4
2 changed files with 61 additions and 12 deletions
+8
View File
@@ -1486,6 +1486,14 @@ begin
WebBrowser.ExecuteJavaScript(
'if(window.Bridge&&typeof Bridge.onAutofillResult==="function")' +
'Bridge.onAutofillResult(' + BoolToStr(LFillOk, True).ToLower + ')');
// Window hidden (tray) → the in-app failure toast is invisible; surface
// the block via a tray balloon instead (gated by the tray-notifications
// setting inside ShowBalloon).
if (not LFillOk) and
((not Self.Visible) or IsIconic(WindowHandleToPlatform(Self.Handle).Wnd)) then
FBridge.ShowBalloon('Autofill blocked',
'The target window runs as administrator — Windows silently blocks ' +
'simulated keystrokes. Copy the password instead.', True);
// Hide-after (Ctrl+Shift+Q from tray): SendInput is done, the target
// already has focus — now we can safely tray ourselves without