Next.js Discord

Discord Forum

Scroll restoration issue.

Unanswered
Bracco Italiano posted this in #help-forum
Open in Discord
Bracco ItalianoOP
Bug Description:

In the mobile version of the website, there's an issue with scroll restoration. When the user flicks up to scroll down and, during the scroll animation, navigates back to the previous page, the scroll position resets to the top instead of returning to the previous scroll position.

Steps to Reproduce:

Open nextjs.org on a mobile device.
Scroll down to the showcase section and open the page ("The framework of choice when it matters.")
While on the showcase page, flick down to scroll, then immediately press the back button to navigate to the previous page.
Expected behavior:
The page should return to the showcase section with the same scroll position.
Actual behavior:
The page scrolls back to the top.

It seems the scroll animation interrupts Next.js' scroll restoration feature.

Environment:

Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Binaries:
Node: 16.17.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 13.5.6
eslint-config-next: 13.5.6
react: 18.2.0
react-dom: 18.2.0
typescript: 5.0.4
Next.js Config:
output: N/A

Question:
Has this issue been documented anywhere? I couldn't find anything relevant in the GitHub issues or Discord. Any help or guidance would be appreciated!

9 Replies

This is a really really niche bug.... What browser are you using on the phone? Its likely a phone/browser issue more than a nextjs issue
Bracco ItalianoOP
No, its on all nextjs apps/devices
https://github.com/vercel/next.js/issues/53777
or just in general
this guy figured out that it could be a bug from safari itself
works fine on my phone (iphone 11, 17.6.1)
also when i scroll and press the back button it even continues the scroll animation from the point i navigated from
Same, and im using Iphone 15 promax... Thats why I was asking what browser he was using.