From 882c15dada6edf8bdba37bfa3b94f85c303e5bd6 Mon Sep 17 00:00:00 2001 From: Charles Bachmeier Date: Mon, 12 Sep 2022 11:39:07 -0700 Subject: [PATCH] fix: bug where changing tabs can open the searchbar (#4607) * remove onFocus trigger * typo on comment Co-authored-by: Charlie --- src/components/NavBar/SearchBar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/NavBar/SearchBar.tsx b/src/components/NavBar/SearchBar.tsx index b54ed85363..139f846951 100644 --- a/src/components/NavBar/SearchBar.tsx +++ b/src/components/NavBar/SearchBar.tsx @@ -186,7 +186,7 @@ export const SearchBarDropdown = ({ toggleOpen, tokens, collections, hasInput, i (isNFTPage || !isTokenPage ? trendingCollections?.length ?? 0 : 0) + (isTokenPage || !isNFTPage ? trendingTokens?.length ?? 0 : 0) - // Close the modal on escape + // Navigate search results via arrow keys useEffect(() => { const keyDownHandler = (event: KeyboardEvent) => { if (event.key === 'ArrowUp') { @@ -344,6 +344,7 @@ export const SearchBar = () => { const [reducedTokens, reducedCollections] = organizeSearchResults(isNFTPage, tokens ?? [], collections ?? []) + // close dropdown on escape useEffect(() => { const escapeKeyDownHandler = (event: KeyboardEvent) => { if (event.key === 'Escape' && isOpen) { @@ -394,7 +395,6 @@ export const SearchBar = () => { borderTopRightRadius={isOpen && !isMobile ? '12' : undefined} borderTopLeftRadius={isOpen && !isMobile ? '12' : undefined} borderBottomWidth={isOpen || isMobileOrTablet ? '0px' : '1px'} - onFocus={() => !isOpen && toggleOpen()} onClick={() => !isOpen && toggleOpen()} gap="12" >