feat(ui): focus search with Ctrl+F

Ctrl+F is a common search shortcut and should open the launcher search just
like the existing slash shortcut. Handle it in the same SearchField keydown
listener so the behavior stays scoped to the topbar search component.

The shortcut is ignored while the user is already typing in another input or
textarea, matching the existing slash behavior. When handled, it prevents the
webview's browser find UI and focuses the app search field instead.

Test Plan:
- `just frontend-test`

Refs: none
This commit is contained in:
2026-05-21 19:44:32 +02:00
parent 0151d7a16c
commit debb1c0c49
@@ -8,15 +8,17 @@ interface Props {
}
/**
* Search input with a `/` keyboard shortcut for focus. Ignores the shortcut
* when the user is already typing into another input or textarea.
* Search input with `/` and Ctrl+F keyboard shortcuts for focus. Ignores
* shortcuts when the user is already typing into another input or textarea.
*/
export const SearchField = ({ value, onChange }: Props) => {
const inputRef = useRef<HTMLInputElement | null>(null);
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
if (e.key !== '/') return;
const isFindShortcut = e.ctrlKey && !e.altKey && !e.shiftKey
&& e.key.toLowerCase() === 'f';
if (e.key !== '/' && !isFindShortcut) return;
const target = e.target as HTMLElement | null;
if (target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA')) return;
e.preventDefault();