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
When the CSS overflow: auto; height: 100% is applied to the html and body tags, it results in navigation via to not reset scroll position to the top. This has been raised before in other issues, for example in issue #7454 where several comments have mentioned the overflow problem.
Steps to reproduce
You can recreate this from gatsby-default-starter:
Add global styles:
html,
body,
{
height: 100%;
overflow: auto;
}
Add some filler content to page 1 and page 2 so that scrollbar shows up
Scroll to bottom of page and click the link to go to the other page
I managed to fix this by changing the CSS to 100vh instead of 100% on the html and body tags, as well as any necessary child elements, although I can't explain why this fixes it.
Apologies for the non-issue, but I based on what I've seen there has been a decent amount of confusion about this, so I'll leave it open for a while longer in case anyone wants to comment or clarify anything.
I'll close the issue as you discovered it doesn't seem strictly Gatsby related. It doesn't mean discussion should stop here, just that we need open issues to be actionable. We can still comment on close issue and issue will still be still searchable/discoverable.
I personally don't know inner working of browser in this area and how to explain why 100% vs 100vh result in such behaviours. I did find jensimmons/cssremedy#70 tho which might be good idea to try some snippets mentioned there that might account for different browser quirks (specifically iOS Safari)?
Description
When the CSS
overflow: auto; height: 100%
is applied to the html and body tags, it results in navigation via to not reset scroll position to the top. This has been raised before in other issues, for example in issue #7454 where several comments have mentioned the overflow problem.Steps to reproduce
You can recreate this from gatsby-default-starter:
Demo:
https://github.com/benjmo/gatsby-scroll-bug-demo
Expected result
Scroll is reset to top of page.
Actual result
Scroll position is unchanged.
Environment
The text was updated successfully, but these errors were encountered: