Skip to content

Commit 602a6e5

Browse files
committed
fix: refocus search input on repeated Cmd+F
When the search bar was already open, Cmd+F was a no-op because setting the isOpen atom to true again had no effect. Now detect the already-open case and directly focus + select-all the input so the user can immediately type a new query.
1 parent 0c7392e commit 602a6e5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

frontend/app/store/keymodel.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,15 @@ function registerGlobalKeys() {
695695
return false;
696696
}
697697
if (bcm.viewModel.searchAtoms) {
698-
globalStore.set(bcm.viewModel.searchAtoms.isOpen, true);
698+
if (globalStore.get(bcm.viewModel.searchAtoms.isOpen)) {
699+
// Already open — just focus the input and select all so the user
700+
// can immediately type a new query.
701+
const input = document.querySelector<HTMLInputElement>(".search-container input");
702+
input?.focus();
703+
input?.select();
704+
} else {
705+
globalStore.set(bcm.viewModel.searchAtoms.isOpen, true);
706+
}
699707
return true;
700708
}
701709
return false;

0 commit comments

Comments
 (0)