Browser Scroll Restoration Is Broken on SPAs. Here's How a Chrome Extension Fixes It. (opens in new tab)
Chrome has had scroll restoration support since 2015. You can even control it: history.scrollRestoration = 'manual'. But if you've ever tried to reliably restore a user's position on a React or Next.js app, you know it doesn't work the way you'd expect. Here's what breaks, why it breaks, and how a browser extension can sidestep the entire problem. What the Browser Actually Does The default behavior is history.scrollRestoration = 'auto'. When you navigate back to a page, the browser tries to s...
Read the original article