Skip to content

Commit 92bdeff

Browse files
committed
test: use opaque header for Safari flicker
1 parent 4a8bca0 commit 92bdeff

1 file changed

Lines changed: 2 additions & 22 deletions

File tree

src/components/Layout/TopNav/TopNav.tsx

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ export default function TopNav({
167167
const asPath = usePathname() || '/';
168168
const [openMenuPath, setOpenMenuPath] = useState<string | null>(null);
169169
const [showSearch, setShowSearch] = useState(false);
170-
const [isScrolled, setIsScrolled] = useState(false);
171170
const scrollParentRef = useRef<HTMLDivElement>(null);
172171
// Deriving from the path hides the menu as soon as a navigation commits.
173172
// Forget the path afterwards, so going Back doesn't reopen the menu.
@@ -211,24 +210,6 @@ export default function TopNav({
211210
};
212211
}, []);
213212

214-
const scrollDetectorRef = useRef(null);
215-
useEffect(() => {
216-
const observer = new IntersectionObserver(
217-
(entries) => {
218-
entries.forEach((entry) => {
219-
setIsScrolled(!entry.isIntersecting);
220-
});
221-
},
222-
{
223-
root: null,
224-
rootMargin: `0px 0px`,
225-
threshold: 0,
226-
}
227-
);
228-
observer.observe(scrollDetectorRef.current!);
229-
return () => observer.disconnect();
230-
}, []);
231-
232213
const onOpenSearch = useCallback(() => {
233214
startTransition(() => {
234215
setShowSearch(true);
@@ -245,7 +226,6 @@ export default function TopNav({
245226
onOpen={onOpenSearch}
246227
onClose={onCloseSearch}
247228
/>
248-
<div ref={scrollDetectorRef} />
249229
<div
250230
className={cn(
251231
isMenuOpen
@@ -254,8 +234,8 @@ export default function TopNav({
254234
)}>
255235
<nav
256236
className={cn(
257-
'duration-300 backdrop-filter backdrop-blur-lg backdrop-saturate-200 transition-shadow bg-opacity-90 items-center w-full flex justify-between bg-wash dark:bg-wash-dark dark:bg-opacity-95 px-1.5 lg:pe-5 lg:ps-4 z-40',
258-
{'dark:shadow-nav-dark shadow-nav': isScrolled || isMenuOpen}
237+
'items-center w-full flex justify-between bg-wash dark:bg-wash-dark px-1.5 lg:pe-5 lg:ps-4 z-40',
238+
isMenuOpen && 'dark:shadow-nav-dark shadow-nav'
259239
)}>
260240
<div className="flex items-center justify-between w-full h-16 gap-0 sm:gap-3">
261241
<div className="flex flex-row 3xl:flex-1 items-centers">

0 commit comments

Comments
 (0)