Every route change was animating a scroll back to the top

Fixkamo-marketing
Shipped
August 19, 2026 at 4:05 PM UTC
Author
Kamo
Commit
38fcc37

<html> carried Tailwind's `scroll-smooth` and nothing else. Next suppresses smooth scrolling while it scrolls to a new route, but only for pages that declare it as a data attribute: **************** reads **************** and on not finding it concludes "no smooth scrolling configured" and calls window.scrollTo() unguarded. The class is invisible to that check, so CSS animated the scroll instead — from wherever the reader was, all the way to the top, on every single click. Deep into a long page that is well over a second of watching the viewport glide while the new page sits already rendered underneath it. Next only warns about this in development, so it shipped silently. Adding data-scroll-behavior="smooth" is the whole fix, and it explains every part of the report that the previous five rounds did not: - refresh was fast, clicking through to the same page was slow: a refresh starts at the top and has nothing to scroll - every page except the homepage: HomeClient fired an instant window.scrollTo(0, 0) on mount, which pre-empted the animation. That workaround is removed here — it would otherwise override scroll restoration and throw a reader returning to the homepage back to the top instead of where they left off - the server measured clean throughout, because it was never the server Guarded in check-client-navigation.mjs, which now fails the build if <html> enables smooth scrolling without the data attribute. Verified both ways: it passes as committed, and it flags the exact line if the attribute is removed.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing