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();