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

Drawer Navigation Issue: Scrolling to Top on Back Navigation with React Router #200

Closed
shkumbinhasani opened this issue Jan 11, 2024 · 2 comments

Comments

@shkumbinhasani
Copy link
Contributor

shkumbinhasani commented Jan 11, 2024

We are facing an issue while integrating Vault with a route-specific opening. Our setup includes tabs within a drawer component. The problem arises when a user interacts with these tabs and then navigates back, leading to an unintended scroll to the top of the page. Below are the key observations and steps we've tried:

  • The issue does not occur with a standard modal implementation.
  • The issue is not present when using the Radix Modal.
  • The problem does not manifest during the first use.
  • The issue consistently occurs after the drawer has been opened and a page navigation action follows.

Any insights or solutions to address this problem would be greatly appreciated. 😃

Sandbox: https://codesandbox.io/p/sandbox/gracious-golick-jcrczn
Video:

Screen.Recording.2024-01-11.at.4.10.26.PM.mov
@shkumbinhasani
Copy link
Contributor Author

I found out this is being caused by this part here

if (activeUrl !== window.location.href) {

I see that this functionality is meant to be like this, In our use-case after x time of scrolling loosing track can be quite a bad UX, that why I introduced preventScrollRestoration that defaults to true to not break anything.

#202

@emilkowalski
Copy link
Owner

Fixed in #202

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

No branches or pull requests

2 participants