Closed iamlinkus closed 3 years ago
Native browser scrolling will restore the previous position after a refresh or via browser back/forward history buttons which is what causes this. I usually disable this with:
if ('scrollRestoration' in window.history) {
window.history.scrollRestoration = 'manual'
}
I do think ASScroll should just start at that previous position, rather than lerp to it though. So I'll update that.
Was trying to figure this out yesterday and came to the same conclusion, thanks!
And I agree that ASScroll should not lerp in that specific scenario. Thanks for fixing it!
My team started a project with ASScroll and we're using it with Highway from Dogstudio.
We've encountered a bug where if the user scrolls down on a page and then refreshes the page, immediatelly after the refresh, the page scrolls down to the last position it was before the refresh. We thought it was a bug in our end, but after further research, forked the PJAX example (linked in the readme) and it does the exact same thing.
Here's a video illustrating the problem: https://cln.sh/PzSspZ