diff --git a/src/components/scroll-context.tsx b/src/components/scroll-context.tsx index f5ffeeb60..74470e279 100644 --- a/src/components/scroll-context.tsx +++ b/src/components/scroll-context.tsx @@ -9,6 +9,12 @@ export const ScrollContext: React.FC = ({ children }) => { const location = useLocation<{ soapboxModalKey?: number } | undefined>(); useEffect(() => { + // HACK: Don't scroll when navigating between posts. + // Surely there's a better way, so that components can negate the behavior from within instead of out here. + if (location.pathname.includes('/posts/')) { + return; + } + if (!location.state?.soapboxModalKey) { window.scrollTo(0, 0); }