Skip to content

Commit 52fe54a

Browse files
committed
fix: scroll to top of page after route change
- previously route changes left could leave the user already partially scolled
1 parent 38d5eb7 commit 52fe54a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pages/_app.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function App({ Component, pageProps }: AppProps): ReactElement {
1515
useEffect(() => {
1616
if (analytics) {
1717
Router.events.on("routeChangeComplete", (url) => {
18+
window.scrollTo(0, 0);
1819
analytics.logEvent(`routeChangeComplete: ${url}`);
1920
});
2021
Router.events.on("hashChangeComplete", (url) =>

0 commit comments

Comments
 (0)