Stop route changes from animating scroll position - #1295
Open
DanPiazza-Netwrix wants to merge 1 commit into
Open
Stop route changes from animating scroll position#1295DanPiazza-Netwrix wants to merge 1 commit into
DanPiazza-Netwrix wants to merge 1 commit into
Conversation
Global scroll-behavior: smooth caused every page navigation to visibly glide instead of snap, since Docusaurus resets scroll via window.scrollTo/scrollIntoView on each route change. Add a client module that disables smooth scrolling for cross-page navigation (landing at the top or at an anchor instantly) while keeping it for same-page anchor clicks like TOC links. Also handles two edge cases: a fresh full-page load to a hash URL (where the target element doesn't exist yet in the dev server's client-rendered shell), and layout settling after the element first appears so anchors aren't left obscured by the sticky navbar.
DanPiazza-Netwrix
temporarily deployed
to
development
July 30, 2026 23:03 — with
GitHub Actions
Inactive
Contributor
Code ReviewReviewed for correctness (bugs, security, build/routing, workflows) — documentation/style excluded per scope. No issues found. This is a clean, well-contained change. Notes from the review:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scroll-behavior: smooth(src/css/custom.css) made every page navigation visibly animate scroll-to-top/anchor instead of snapping, since Docusaurus resets scroll position viawindow.scrollTo/scrollIntoViewon each route changesrc/clientModules/scrollBehavior.js, registered viaclientModulesindocusaurus.config.js, that disables smooth scrolling for cross-page navigation while preserving it for same-page anchor clicks (TOC links, etc.)Test plan