Skip to content

Add scroll to top on navigation #5891

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

Closed
wants to merge 3 commits into from
Closed

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Feb 9, 2021

Problem

React-router doesn't manage scroll changes on navigation. As a consequence, when users click on an item low in the menu, or on the pagination controls, the new content may reveal up hidden in the non-visible area of the page. This is disturbing for end users.

scrollToTop

On the other hand, the page should not scroll to top everywhere, and especially not when using the back button.

Solution

  • Enable scroll to top by default in <List>, <Create>, <Edit> and <Show>
  • Allow users to disable it using the disableScrollToTop prop
  • Add documentation

scrollToTop2

@fzaninotto
Copy link
Member Author

I'll take another approach based on adding a parameter to links rather than adding a watcher in pages. It'll be more flexible.

@fzaninotto fzaninotto closed this Feb 12, 2021
@fzaninotto fzaninotto deleted the useScrollRestoration branch March 15, 2021 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants