How to modify default router scroll behavior #2197
Unanswered
ylli2000
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
-
Story:
If I have a music app, the home page is a long list of songs that scrolls down 3-4 screens long. When clicking a song, it goes into the detail page of that song.
Scenario:
Expected behavior:
top: 0
top: pageHeight - screenHeight
Current behavior:
top: pageHeight - screenHeight
<<< not expecting this, I should see the top of the song detail pagetop: pageHeight - screenHeight
Now, if at step 2., before I return to home page, I first scroll back to the
top: 0
of the detail page screen, then hit the back button to return to home page, router will also scroll to the top of the screen at home page attop: 0
, <<< also not expecting this, because I clicked the last song at the bottom of the page, I would expect to return to the bottom of the pageI would expect the router to remember the home screen position and scroll to the bottom at
top: pageHeight - screenHeight
I have disabled this behavior by hardwiring the scrolling behavior to always get back to the top of the screen at
top:0
:As you can see, this is not perfect. How do I get the wanted behavior, which is to let the router remember the correct page position when returning to the home page, and not go to the wrong position when visiting the detail page?
Beta Was this translation helpful? Give feedback.
All reactions