From fb621c3b1f7bbf8542a6bd9cfb432150175c9a14 Mon Sep 17 00:00:00 2001 From: Shane Kennedy Date: Wed, 22 Apr 2026 09:27:09 +0200 Subject: [PATCH 1/2] fix: cmd+click should not close search pallete --- src/components/SearchModal.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/SearchModal.tsx b/src/components/SearchModal.tsx index 8f1c70c76..e1b4d9b09 100644 --- a/src/components/SearchModal.tsx +++ b/src/components/SearchModal.tsx @@ -421,7 +421,10 @@ const Hit = ({ } } - const handleClick = () => { + const handleClick = (event: React.MouseEvent) => { + if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) { + return + } closeSearch() } From 5cb88497fdcdd8fee1bd6f33903b59c21297cfcf Mon Sep 17 00:00:00 2001 From: Shane Kennedy Date: Wed, 22 Apr 2026 09:28:30 +0200 Subject: [PATCH 2/2] fix: cmd+k focuses cursor on search input --- src/components/SearchModal.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/components/SearchModal.tsx b/src/components/SearchModal.tsx index e1b4d9b09..f78af36de 100644 --- a/src/components/SearchModal.tsx +++ b/src/components/SearchModal.tsx @@ -782,6 +782,22 @@ export function SearchModal() { } }, [isOpen]) + React.useEffect(() => { + if (!isOpen) return + + const focusSearchInput = () => { + const input = containerRef.current?.querySelector( + 'input[type="search"]', + ) + input?.focus() + } + + const id = window.requestAnimationFrame(() => { + window.requestAnimationFrame(focusSearchInput) + }) + return () => window.cancelAnimationFrame(id) + }, [isOpen]) + const focusedIndexRef = React.useRef(focusedIndex) React.useEffect(() => { @@ -835,6 +851,7 @@ export function SearchModal() { className="fixed z-[1000] top-8 left-1/2 -translate-x-1/2 w-[98%] xl:w-full max-w-3xl text-left bg-white/80 dark:bg-black/80 shadow-lg rounded-lg xl:rounded-xl divide-y divide-gray-500/20 backdrop-blur-lg dark:border dark:border-white/20 outline-none" ref={containerRef} onKeyDown={handleKeyDown} + onOpenAutoFocus={(event) => event.preventDefault()} > Search TanStack docs @@ -859,8 +876,6 @@ export function SearchModal() { reset: 'p-1 opacity-50 hover:opacity-100', }} resetIconComponent={resetIconComponent} - // eslint-disable-next-line jsx-a11y/no-autofocus - autoFocus />