Skip to content

Commit

Permalink
Improve Homepage Search: Automatically Hide Dropdown on Typing (#4953)
Browse files Browse the repository at this point in the history
* update dropdown

* Close study search dropdown on keypress

---------

Co-authored-by: alisman <[email protected]>
  • Loading branch information
GarvitDadheech and alisman authored Jan 17, 2025
1 parent ce9f9fd commit 8fce8f8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/shared/components/query/StudySearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ export const StudySearch: FunctionComponent<StudySearchProps> = observer(
}, []);

const onKeyDownSearchBox = useCallback(
(e: React.KeyboardEvent<HTMLInputElement>) => {
if ([13, 27].includes(e.keyCode)) {
async (e: React.KeyboardEvent<HTMLInputElement>) => {
if (store.isMenuOpen) {
await sleep(500);
store.setMenuOpen(false);
} else {
store.setMenuOpen(true);
}
},
[]
Expand Down

0 comments on commit 8fce8f8

Please sign in to comment.