diff --git a/website/src/components/layout/article/article-layout.tsx b/website/src/components/layout/article/article-layout.tsx index 1ef45b0a1c3..ea90086e058 100644 --- a/website/src/components/layout/article/article-layout.tsx +++ b/website/src/components/layout/article/article-layout.tsx @@ -26,7 +26,7 @@ export function ArticleLayout({ return ( - + {navigation} diff --git a/website/src/components/layout/site/header.tsx b/website/src/components/layout/site/header.tsx index 8534fd7b6e0..deae707c776 100644 --- a/website/src/components/layout/site/header.tsx +++ b/website/src/components/layout/site/header.tsx @@ -232,6 +232,7 @@ const Container = styled.header` border-bottom: 1px solid ${THEME_COLORS.boxBorder}; width: 100vw; height: 72px; + overflow: hidden; ${ApplyBackdropBlur(48, `background-color: ${THEME_COLORS.backgroundMenu};`)} `; diff --git a/website/src/components/layout/site/main.tsx b/website/src/components/layout/site/main.tsx index dc3d04d801d..987cb6a3cde 100644 --- a/website/src/components/layout/site/main.tsx +++ b/website/src/components/layout/site/main.tsx @@ -1,4 +1,4 @@ -import React, { FC, PropsWithChildren, useEffect, useRef } from "react"; +import React, { FC, PropsWithChildren, useEffect } from "react"; import { useDispatch } from "react-redux"; import styled from "styled-components"; @@ -8,7 +8,6 @@ import { Footer } from "./footer"; import { Header } from "./header"; export const Main: FC> = ({ children }) => { - const ref = useRef(null); const dispatch = useDispatch(); useEffect(() => { @@ -19,23 +18,19 @@ export const Main: FC> = ({ children }) => { ); const handleScroll = () => { - if (!ref.current || ref.current.scrollTop === undefined) { - return; - } - dispatch( hasScrolled({ - yScrollPosition: ref.current.scrollTop, + yScrollPosition: window.scrollY, }) ); }; - ref.current?.addEventListener("scroll", handleScroll, { passive: true }); + window.addEventListener("scroll", handleScroll, { passive: true }); return () => { - ref.current?.removeEventListener("scroll", handleScroll); + window.removeEventListener("scroll", handleScroll); }; - }, []); + }, [dispatch]); useEffect(() => { const { hash } = window.location; @@ -48,14 +43,14 @@ export const Main: FC> = ({ children }) => { }); const scrollToTop = () => { - ref.current?.scrollTo({ + window.scrollTo({ top: 0, behavior: "smooth", }); }; return ( - +
{children}