File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ export const UniversalNav = ({
37
37
38
38
const search =
39
39
typeof window !== `undefined` && isLanding ( window . location . pathname ) ? (
40
- < SearchBarOptimized />
40
+ < SearchBarOptimized innerRef = { searchBarRef } />
41
41
) : (
42
42
< SearchBar innerRef = { searchBarRef } />
43
43
) ;
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ export class Header extends React.Component<
44
44
this . state . displayMenu &&
45
45
this . menuButtonRef . current &&
46
46
! this . menuButtonRef . current . contains ( event . target ) &&
47
+ // since the search bar is part of the menu on small screens, clicks on
48
+ // the search bar should not toggle the menu
47
49
this . searchBarRef . current &&
48
50
! this . searchBarRef . current . contains ( event . target )
49
51
) {
Original file line number Diff line number Diff line change @@ -3,7 +3,11 @@ import { useTranslation } from 'react-i18next';
3
3
import Magnifier from '../../../assets/icons/Magnifier' ;
4
4
import { searchPageUrl } from '../../../utils/algolia-locale-setup' ;
5
5
6
- const SearchBarOptimized = ( ) : JSX . Element => {
6
+ type Props = {
7
+ innerRef ?: React . RefObject < HTMLDivElement > ;
8
+ } ;
9
+
10
+ const SearchBarOptimized = ( { innerRef } : Props ) : JSX . Element => {
7
11
const { t } = useTranslation ( ) ;
8
12
const placeholder = t ( 'search.placeholder' ) ;
9
13
const searchUrl = searchPageUrl ;
@@ -18,7 +22,7 @@ const SearchBarOptimized = (): JSX.Element => {
18
22
} ;
19
23
20
24
return (
21
- < div className = 'fcc_searchBar' data-testid = 'fcc_searchBar' >
25
+ < div className = 'fcc_searchBar' data-testid = 'fcc_searchBar' ref = { innerRef } >
22
26
< div className = 'fcc_search_wrapper' >
23
27
< div className = 'ais-SearchBox' data-cy = 'ais-SearchBox' >
24
28
< form
You can’t perform that action at this time.
0 commit comments