From debb1c0c4999536dca7793f17a110e67ba606d93 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Thu, 21 May 2026 19:44:32 +0200 Subject: [PATCH] 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 --- .../src/components/topbar/SearchField.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/lanspread-tauri-deno-ts/src/components/topbar/SearchField.tsx b/crates/lanspread-tauri-deno-ts/src/components/topbar/SearchField.tsx index 82336c0..3af0e7d 100644 --- a/crates/lanspread-tauri-deno-ts/src/components/topbar/SearchField.tsx +++ b/crates/lanspread-tauri-deno-ts/src/components/topbar/SearchField.tsx @@ -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(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();