diff --git a/packages/graphiql-react/src/explorer/components/search.tsx b/packages/graphiql-react/src/explorer/components/search.tsx index 7affdeca08a..d7e5410d4a0 100644 --- a/packages/graphiql-react/src/explorer/components/search.tsx +++ b/packages/graphiql-react/src/explorer/components/search.tsx @@ -70,9 +70,12 @@ export function Search() { [push], ); const [isFocused, setIsFocused] = useState(false); - const handleFocus: FocusEventHandler = useCallback(e => { - setIsFocused(e.type === 'focus'); - }, []); + const handleFocus: FocusEventHandler = useCallback( + e => { + setIsFocused(e.type === 'focus'); + }, + [setIsFocused], + ); const shouldSearchBoxAppear = explorerNavStack.length === 1 || @@ -101,7 +104,8 @@ export function Search() { setSearchValue(event.target.value)} placeholder="⌘ K" ref={inputRef} @@ -110,7 +114,7 @@ export function Search() { /> - {/* hide on blur */} + {/* display on focus */} {isFocused && ( {results.within.length +