gatsby-using-page-transitions
gatsby-using-page-transitions copied to clipboard
Scroll position lost on pop state (when clicking browser back/forward buttons)
Hey @ryanwiemer — I've been using bits of your code from this example to implement page transitions on my Gatsby projects and it works great!
I've noticed in the last few months is that scroll restoration no longer works on popstate, despite this logic:
https://github.com/ryanwiemer/gatsby-using-page-transitions/blob/c4a52268d5bb9d7e98a3c5ef1a92a0c4ba90fbd0/gatsby-browser.js#L10-L24
I was wondering if you'd come across that issue and had any thoughts on a workaround.
Possibly related to this issue: https://github.com/gatsbyjs/gatsby/issues/23842 ?
When I console.log(savedPosition) within the else statement, I get 0, though I see all the scroll position entries saved in local storage.
@blimpmason was this ever fixed on Gatsby's side? This seems like an upstream issue that Gatsby needs to resolve.
@ryanwiemer you're absolutely right, and I submitted an issue to Gatsby in October along with minimal reproduction demos and repos. The issue been acknowledged and I think there's an outstanding pull request that addresses it: https://github.com/gatsbyjs/gatsby/issues/27349