You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Category landing pages smooth-scroll to footer on load in WebKit/Safari #45322
I have read and agree to the GitHub Docs project's Code of Conduct
What article on docs.github.com is affected?
Summary
When navigating directly to category landing pages or short-link redirects in WebKit/Safari, the browser automatically performs a smooth scroll animation all the way down to the footer upon initial load/reload.
Steps to Reproduce
Open Safari.
Navigate directly to https://docs.github.com/en/account-and-profile.
Allow the page to hydrate or reload the page (Cmd + R or Cmd + Option + R).
Observe the viewport smoothly animating down to the footer (~1000px+).
Expected Behavior
The viewport should remain anchored at the very top (scrollTop = 0) if I entered the page directly.
Actual Behavior
The page executes a smooth-scroll animation down to the footer.
Screen.Recording.2026-07-27.at.17.34.09.mov
What changes are you suggesting?
Possible root cause
Primer CSS applies scroll-behavior: smooth; unconditionally on html. During Next.js client-side hydration, as document height expands while WebKit handles initial scroll restoration, WebKit's smooth-scroll animation miscalculates target progress relative to the shifting DOM height and animates the viewport down to the bottom. In other words, Safari's a mess.
Possible fix
I have identified a fix in src/frame/stylesheets/index.scss by scoping scroll-behavior: smooth to html:focus-within and am ready to submit a PR linking to this issue.
Additional information
Reproducible URLs
https://docs.github.com/en/account-and-profile
https://docs.github.com/copilot (redirects to /en/copilot)
Primer CSS applies scroll-behavior: smooth; unconditionally to html. During Next.js client-side hydration in Safari/WebKit, as the document height expands while WebKit handles initial scroll restoration, WebKit's smooth-scroll engine miscalculates the target scroll progress relative to the shifting DOM height and animates the viewport all the way down to the footer (~1000px+).
Verified Fix:
Overriding scroll-behavior: auto !important; on html and scoping scroll-behavior: smooth to html:focus-within in src/frame/stylesheets/index.scss resolves the autoscroll bug completely on page load while preserving smooth scrolling for anchor links (#section-id) and keyboard navigation:
/* Prevent WebKit smooth-scroll hydration bug on page load */html {
scroll-behavior: auto!important;
}
/* Enable smooth scrolling when navigating via keyboard or anchor links */html:focus-within {
scroll-behavior: smooth;
}
I closed #45323 since external contributions to src/** aren't accepted per repository policy.
Activity
schimanko commentedon Jul 27, 2026
PR Details
For maintainers looking to resolve this:
Root Cause:
Primer CSS applies
scroll-behavior: smooth;unconditionally tohtml. During Next.js client-side hydration in Safari/WebKit, as the document height expands while WebKit handles initial scroll restoration, WebKit's smooth-scroll engine miscalculates the target scroll progress relative to the shifting DOM height and animates the viewport all the way down to the footer (~1000px+).Verified Fix:
Overriding
scroll-behavior: auto !important;onhtmland scopingscroll-behavior: smoothtohtml:focus-withininsrc/frame/stylesheets/index.scssresolves the autoscroll bug completely on page load while preserving smooth scrolling for anchor links (#section-id) and keyboard navigation:I closed #45323 since external contributions to src/** aren't accepted per repository policy.
Sharra-writes commentedon Aug 6, 2026
@schimanko This is site functionality, not documentation, so we can't handle it from this repository. This will have to go through the support team.
spacexm406-web commentedon Sep 1, 2026
Yes you have full permission