feat: Change global search shortcut from Cmd+K to Ctrl+Shift+F

This commit is contained in:
jlightner 2026-03-31 17:33:09 +00:00
parent 44f2fbd4d6
commit 11f7ca4fbf
2 changed files with 5 additions and 5 deletions

View file

@ -67,7 +67,7 @@ export default function App() {
<SearchAutocomplete
variant="nav"
globalShortcut
placeholder="Search… ⌘K"
placeholder="Search… Ctrl+⇧F"
onSearch={(q) => navigate(`/search?q=${encodeURIComponent(q)}`)}
/>
)}

View file

@ -24,7 +24,7 @@ interface SearchAutocompleteProps {
variant?: 'hero' | 'inline' | 'nav';
initialQuery?: string;
autoFocus?: boolean;
/** When true, Cmd+K / Ctrl+K focuses the input globally */
/** When true, Ctrl+Shift+F focuses the input globally */
globalShortcut?: boolean;
}
@ -72,11 +72,11 @@ export default function SearchAutocomplete({
if (autoFocus) inputRef.current?.focus();
}, [autoFocus]);
// Global Cmd+K / Ctrl+K shortcut to focus input
// Global Ctrl+Shift+F shortcut to focus input
useEffect(() => {
if (!globalShortcut) return;
function handleGlobalKey(e: KeyboardEvent) {
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
if (e.key === "F" && e.ctrlKey && e.shiftKey) {
e.preventDefault();
inputRef.current?.focus();
}
@ -188,7 +188,7 @@ export default function SearchAutocomplete({
</button>
)}
{variant === 'nav' && (
<kbd className="search-nav__shortcut">K</kbd>
<kbd className="search-nav__shortcut">CtrlF</kbd>
)}
</form>