Skip to content

Commit

Permalink
search dropdown click #3307
Browse files Browse the repository at this point in the history
  • Loading branch information
acao committed Jul 23, 2023
1 parent 1dd51f1 commit 582edc8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/graphiql-react/src/explorer/components/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down Expand Up @@ -101,7 +104,8 @@ export function Search() {
<Combobox.Input
autoComplete="off"
onFocus={handleFocus}
onBlur={handleFocus}
// TODO: find a better way to handle onBlur
// onBlur={handleFocus}
onChange={event => setSearchValue(event.target.value)}
placeholder="&#x2318; K"
ref={inputRef}
Expand All @@ -110,7 +114,7 @@ export function Search() {
/>
</div>

{/* hide on blur */}
{/* display on focus */}
{isFocused && (
<Combobox.Options data-cy="doc-explorer-list">
{results.within.length +
Expand Down

0 comments on commit 582edc8

Please sign in to comment.