From f91afcccce08a062f91c287fb831cea19e54356d Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Sun, 4 Jan 2026 15:58:38 +0300 Subject: [PATCH] Scroll to top on profile link click Add an id to the main container and a scrollToTop helper that smooth-scrolls #app-container to top. Call it alongside setActiveKey on profile Links and replace the external anchor with an internal Link. --- apps/web/src/layouts/Main.tsx | 5 ++- .../web/src/pages/profile/circles/Circles.tsx | 32 ++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/apps/web/src/layouts/Main.tsx b/apps/web/src/layouts/Main.tsx index 9e794d23..520e20a3 100644 --- a/apps/web/src/layouts/Main.tsx +++ b/apps/web/src/layouts/Main.tsx @@ -162,7 +162,10 @@ function Main(props: MainProps) { }; return ( - + { + const container = document.querySelector("#app-container"); + if (container) { + container.scrollTo({ top: 0, behavior: "smooth" }); + } +}; + function Circles() { const [, setActiveKey] = useAtom(activeTabAtom); const [follows, setFollows] = useAtom(followsAtom); @@ -76,7 +83,10 @@ function Circles() { setActiveKey(0)} + onClick={() => { + setActiveKey(0); + scrollToTop(); + }} > setActiveKey(0)} + onClick={() => { + setActiveKey(0); + scrollToTop(); + }} > {neighbour.displayName} - { + setActiveKey(0); + scrollToTop(); + }} > @{neighbour.handle} - +

They both listen to{" "} -- 2.51.2