From 4243e38ad111bc142de9704a38e64bf3939c3a96 Mon Sep 17 00:00:00 2001 From: Daniel Rebouta Date: Tue, 14 Oct 2025 22:15:56 +0200 Subject: [PATCH 1/7] Fix JumpToTop syle, to make use of transition --- website/src/components/misc/page-top.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/website/src/components/misc/page-top.tsx b/website/src/components/misc/page-top.tsx index 00d4dd0328f..200b9d810c6 100644 --- a/website/src/components/misc/page-top.tsx +++ b/website/src/components/misc/page-top.tsx @@ -37,7 +37,6 @@ export const PageTop: FC = ({ onTopScroll }) => { }; const JumpToTop = styled.button` - display: none; position: fixed; right: 24px; bottom: 24px; @@ -47,11 +46,12 @@ const JumpToTop = styled.button` width: 42px; height: 42px; background-color: ${THEME_COLORS.text}; - opacity: 0.6; - transition: opacity 0.2s ease-in-out; - + opacity: 0; + visibility: hidden; + transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out; &.show { - display: initial; + opacity: 0.6; + visibility: visible; } &:hover { From fb154fede61e70b8d84ba374f8c7f8a55937ea44 Mon Sep 17 00:00:00 2001 From: Daniel Rebouta Date: Thu, 16 Oct 2025 00:44:07 +0200 Subject: [PATCH 2/7] Use window scroll instead --- website/src/components/layout/site/main.tsx | 21 +++++++-------------- website/src/style/global-style.tsx | 8 +------- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/website/src/components/layout/site/main.tsx b/website/src/components/layout/site/main.tsx index dc3d04d801d..bb96e17fd55 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}