Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll is reset on back navigation #437

Closed
j-maas opened this issue Nov 5, 2023 · 1 comment
Closed

Scroll is reset on back navigation #437

j-maas opened this issue Nov 5, 2023 · 1 comment

Comments

@j-maas
Copy link
Contributor

j-maas commented Nov 5, 2023

I noticed a few issues with how back navigation is handled with respect to scrolling.

  1. When I scroll down on a page, open a link, and using the browser's back button go back to the previous page, the scroll position is reset to the top of the page. Normal browser behavior is to remember the scroll position when navigation back.
  2. When I click the back button, there is a short flash where it seems that the page is scrolled to the top and then the content is changed. Ideally, the content change and scrolling would happen simultaneously.

For handling the scroll restauration on back navigation, react-router seems to follow this strategy:

  1. On each navigation, store the scroll position in session storage.
    • This probably is not necessary for fragment changes, because to my knowledge the browser can handle those even in single page application, since they usually happen on the same (logical) page.
  2. When navigating back, the scroll position is retrieved from the session storage and scrolled to.
@Strepto
Copy link

Strepto commented Nov 6, 2023

This was discussed a bit in #294 if that can be of any help.

I did not resolve it though. (I reported is as a end-user and not a developer. I have not actually used elm-pages )

@j-maas j-maas closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants