Skip to content

Commit 50eda04

Browse files
fix(docs): prevent search overlay overlapping branding on mobile Closes #1660
1 parent ba39cbe commit 50eda04

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/components/search.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,22 @@ export const Mobile = ({
106106
const siteMetadata = useSiteMetadata()
107107
const getCloseAnimation = exit => (isForceClose ? undefined : {exit})
108108

109+
const handleSearchToggle = React.useCallback(() => {
110+
setMobileSearchOpen(true)
111+
}, [setMobileSearchOpen])
112+
109113
return (
110114
<>
111-
<Button aria-label="Search" aria-expanded={isMobileSearchOpen} onClick={() => setMobileSearchOpen(true)}>
112-
<SearchIcon />
113-
</Button>
115+
{!isMobileSearchOpen && (
116+
<Button
117+
aria-label="Search"
118+
aria-expanded={isMobileSearchOpen}
119+
onClick={handleSearchToggle}
120+
>
121+
<SearchIcon />
122+
</Button>
123+
)}
124+
114125
<AnimatePresence>
115126
{isMobileSearchOpen ? (
116127
<FocusOn returnFocus={true} onEscapeKey={() => resetAndClose(true)}>
@@ -157,6 +168,8 @@ export const Mobile = ({
157168
borderRightWidth: 0,
158169
borderColor: 'border.muted',
159170
position: 'relative',
171+
bg: 'canvas.default',
172+
zIndex: 9999,
160173
}}
161174
>
162175
<motion.div

0 commit comments

Comments
 (0)