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
The useElementScrollRestoration hook consistently returns undefined even when properly implemented with a valid data-scroll-restoration-id. The hook should return scroll position data for elements marked with the proper data attribute, but it fails to capture or return any scroll position information.
@johnstack94 upon retesting using the reproduction provided, this feature is working as expected. See screen capture below.
Screen.Recording.2024-11-15.at.23.10.51.mov
For a scroll restoration to happen, you need to have gone back to the page in question.
For example, if you perform the steps of "Go to home", "Scroll down", "Go to about", and then "Go to home", then you've never actually performed a restoration (back navigation). So a restoration doesn't happen here, since the instructions the browser is getting is "Forward", "Forward", "Forward".
For restoration to happen in this instance, the order of steps needs to be "Go to home", "Scroll down", "Go to about", and then "Press the back button". Over here, the browser is being told "Forward", "Foward", "Back".
So I modified the basic react query example to have a posts page that lists 75 posts to show the scrollbar. Then we can click on a post to open a new detail post page. In here I also fetch the same posts as I do in the posts page. (simulating a similar posts feature), clicking on a post there does not behave as I expect.
Steps to reproduce:
Click on posts in navbar
Click on a random post in posts page
Scroll down in detail post page and click a new post
I expect the page to scroll to top when navigating to a new post. Changing resetScroll on the Link component doesn't affect this behaviour.
Which project does this relate to?
Router
Describe the bug
The useElementScrollRestoration hook consistently returns undefined even when properly implemented with a valid data-scroll-restoration-id. The hook should return scroll position data for elements marked with the proper data attribute, but it fails to capture or return any scroll position information.
Your Example Website or App
https://stackblitz.com/edit/github-dc3gr8?file=src%2Froutes%2Findex.tsx
Steps to Reproduce the Bug or Issue
Expected behavior
Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: