diff --git a/src/layouts/PrimaryPageLayout/index.tsx b/src/layouts/PrimaryPageLayout/index.tsx index 15d19ff..a8dd6ee 100644 --- a/src/layouts/PrimaryPageLayout/index.tsx +++ b/src/layouts/PrimaryPageLayout/index.tsx @@ -60,7 +60,7 @@ const PrimaryPageLayout = forwardRef( if (isSmallScreen) { return ( - +
+ { - setDeepBrowsing(false) if (!active) return const handleScroll = () => { @@ -51,16 +50,11 @@ export function DeepBrowsingProvider({ } } - if (!scrollAreaRef) { - window.addEventListener('scroll', handleScroll) - return () => { - window.removeEventListener('scroll', handleScroll) - } - } + const target = scrollAreaRef ? scrollAreaRef.current : window - scrollAreaRef.current?.addEventListener('scroll', handleScroll) + target?.addEventListener('scroll', handleScroll) return () => { - scrollAreaRef.current?.removeEventListener('scroll', handleScroll) + target?.removeEventListener('scroll', handleScroll) } }, [active])