From 351ad38f684a3742deebbeaf74809a5f81ee9b7a Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Fri, 29 May 2026 14:50:05 -0700 Subject: [PATCH] Focus file search input from ref (#3330) --- src/renderer/src/components/right-sidebar/Search.tsx | 12 ++++++++---- .../src/components/right-sidebar/SearchHeader.tsx | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/components/right-sidebar/Search.tsx b/src/renderer/src/components/right-sidebar/Search.tsx index c62907d67..82934cfc4 100644 --- a/src/renderer/src/components/right-sidebar/Search.tsx +++ b/src/renderer/src/components/right-sidebar/Search.tsx @@ -106,9 +106,13 @@ export default function Search(): React.JSX.Element { }) }, [cancelSeededInputSelectionFrame]) - // Focus input on mount - useEffect(() => { - inputRef.current?.focus() + const setSearchInputRef = useCallback((el: HTMLInputElement | null): void => { + inputRef.current = el + // Why: focusing belongs to the input mount; the object ref still backs + // seeded-search selection and result keyboard handlers. + if (el) { + el.focus() + } }, []) // Cleanup debounce timer on unmount @@ -324,7 +328,7 @@ export default function Search(): React.JSX.Element { return (