fix(unlock): focus the username first when it is empty, on the quick-search path too

The autofill hotkey already picked whichever field still needed filling; quick search forced the password, so a first unlock or one without a remembered username landed the cursor in the second field.
This commit is contained in:
r-zakarya
2026-08-07 14:53:36 +01:00
parent 476d6660ad
commit afe47259d7
2 changed files with 12 additions and 3 deletions
+10 -2
View File
@@ -543,9 +543,17 @@ const Bridge = (() => {
// Locked vault → fall through to the master-password screen.
openQuickSearch(wasHidden, forFill) {
if (state.locked || !state.cryptoKey || !state.token) {
const pwd = document.getElementById('loginPassword');
const pwd = document.getElementById('loginPassword');
const user = document.getElementById('loginUsername');
if (pwd && !document.getElementById('authScreen').classList.contains('is-hidden')) {
setTimeout(() => pwd.focus(), 60);
// Same rule as the autofill hotkey: land on whichever field
// still needs filling. Forcing the password meant a first
// unlock, or one without a remembered username, put the
// cursor in the second field.
setTimeout(() => {
if (user && !user.value) user.focus();
else pwd.focus();
}, 60);
}
if (typeof toast === 'function')
toast('Vault is locked — unlock to search', 'warning');