gatsby-using-page-transitions icon indicating copy to clipboard operation
gatsby-using-page-transitions copied to clipboard

Scroll position lost on pop state (when clicking browser back/forward buttons)

Open blimpmason opened this issue 4 years ago • 3 comments

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 ?

blimpmason avatar Oct 02 '20 21:10 blimpmason

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 avatar Oct 02 '20 21:10 blimpmason

@blimpmason was this ever fixed on Gatsby's side? This seems like an upstream issue that Gatsby needs to resolve.

ryanwiemer avatar Nov 19 '20 22:11 ryanwiemer

@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

blimpmason avatar Nov 20 '20 00:11 blimpmason