feat: restore scroll position
This PR includes:
- restores scroll position for any timeline: I need to review a few cases (we need to exclude nested entries: replies for example)
- prevents scroll to top when clicking on navigation: updated scroll to top plugin
Registers the status.id or the follower account (url) on session storage and paginator.ts module will restore scroll position. It works with history (back/forward), app navigation and browser refresh.
I'll try to use useStorageAsync.
Tested with reply, status, follow, poll on:
- bookmarks
- favourites
- home
- notifications
- notifications/mention
- Explore > Tags > Accesibility
- Account tabs: posts, post and replies and media
closes #653
Run & review this pull request in StackBlitz Codeflow.
Deploy Preview for elk-zone ready!
| Name | Link |
|---|---|
| Latest commit | 6ce5eadcac0beb09379e1fb5e4555a325114e34d |
| Latest deploy log | https://app.netlify.com/sites/elk-zone/deploys/63bc4e19757f65000944366e |
| Deploy Preview | https://deploy-preview-851--elk-zone.netlify.app/ |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
Deploy Preview for elk-docs canceled.
| Name | Link |
|---|---|
| Latest commit | 6ce5eadcac0beb09379e1fb5e4555a325114e34d |
| Latest deploy log | https://app.netlify.com/sites/elk-docs/deploys/63bc4e19ffb22b0007583c23 |
rn stops working, disable virtual scroll if you want to check this PR: there are still a few cases not registering the scroll position.
With virtual scroll we don't have the elements in the DOM so we cannot use any approach: paginator only with first page, so we cannot scroll by position/id/anchor href.