Why preserve the scroll position on the first navigation? #2110
Unanswered
Dante-dan
asked this question in
Help and Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I noticed that when the page unload, the scroll position is saved in
history.state
.router/packages/router/src/history/html5.ts
Line 129 in 1cf14f8
And it returns to the scroll position when refreshed.
router/packages/router/src/router.ts
Line 1158 in 1cf14f8
But this behavior is confusing, especially when my page is a SPA , where the initial screen is often a skeleton screen or empty. This scrolling is often ineffective.
When my page is outputted through SSR , the scroll position might also be incorrect, for instance, if some content on the page depends on dynamic JavaScript execution, or if the page contains adaptive images.
At the same time, this behavior also goes against the following description:
Because Refresh Page is not a popState.
Beta Was this translation helpful? Give feedback.
All reactions