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

Add scrollToTop on key navigation links #5905

Merged
merged 14 commits into from Feb 15, 2021
Merged

Add scrollToTop on key navigation links #5905

merged 14 commits into from Feb 15, 2021

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Feb 12, 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, applying filters, or switching tabs.

Solution

  • Add a global scrollToTop listener in CoreAdminRouter (resists to layout change)
  • Update Edit, Show, Pagination and Menu buttons to enable scrollToTop
  • Add scrollToTop to useRedirect
  • Add documentation
  • Document other buttons, and start fixing stuff down the rabbit hole
  • ?!!
  • Profit

scrollToTop2

Supersedes #5891

@fzaninotto fzaninotto added the RFR Ready For Review label Feb 13, 2021
@fzaninotto
Copy link
Member Author

Switching to RFR

docs/Buttons.md Show resolved Hide resolved
docs/Buttons.md Show resolved Hide resolved
packages/ra-core/src/core/CoreAdminRouter.tsx Outdated Show resolved Hide resolved
docs/Buttons.md Outdated Show resolved Hide resolved
docs/Buttons.md Outdated Show resolved Hide resolved
Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants