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

feat: Add toggle to restore scroll position for same locations #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tobilen
Copy link

@tobilen tobilen commented Jan 7, 2022

Currently, the scroll restoration only gets restored when the history navigation (either backwards or forwards) is used. In my case, i want the scroll restoration to be restored when a link is clicked on the page that leads to the same location as well.

This PR adds a prop called restoreSameLocation to the RouterScrollProvider. false by default, it will enable this behavior if it is explicitly set.

Tests and documentation has been added as well. Let me know if anything is missing

@tobilen tobilen force-pushed the restore-scroll-position-for-same-sites branch from f1958ae to 8a62362 Compare January 7, 2022 10:20
This will mean that even when not using back/forward buttons,
the scroll position will be restored as long as it is the same
url with the same parameters.
@tobilen tobilen force-pushed the restore-scroll-position-for-same-sites branch from 8a62362 to 82fa624 Compare January 7, 2022 10:38
@tobilen
Copy link
Author

tobilen commented Jan 21, 2022

@satazor anything missing from this?

fyi, i have deployed this fork to tobilen-next-router-scroll for testing purposes

@tobilen
Copy link
Author

tobilen commented Mar 21, 2022

@tiagodinis whats the status on this? can you give an update?

@VladBrok
Copy link

:(

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

Successfully merging this pull request may close these issues.

None yet

2 participants