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

Scroll position preserving doesn't match browser behavior #299

Closed
gaearon opened this issue Sep 19, 2014 · 4 comments
Closed

Scroll position preserving doesn't match browser behavior #299

gaearon opened this issue Sep 19, 2014 · 4 comments

Comments

@gaearon
Copy link
Contributor

gaearon commented Sep 19, 2014

Browser only preserves scrolling position when you go Back or Forward.
If you open the same link twice, browser will scroll it to top.

However, react-router seems to always remember scroll position for every URL.
This means if you scrolled some page, it will forever open scrolled from now on.

I believe react-router should only attempt restoring scroll position if path changed due to popstate, and not due to pushstate.

@ryanflorence
Copy link
Member

I think we already have an issue for this

@mjackson
Copy link
Member

@gaearon I opened #252 to try and nail down the cases where we're scrolling and we shouldn't be, but so far that ticket only mentions clicking on links. Is that what you mean by "open the same link twice"? Or are you doing that via back/forward buttons?

@gaearon
Copy link
Contributor Author

gaearon commented Sep 19, 2014

@mjackson

Click on a link.
Scroll down.
Go back.
Click on it again.

Expected: scrollY = 0, actual: scrollY is restored.

@gaearon
Copy link
Contributor Author

gaearon commented Sep 19, 2014

Right, it's a dupe of #252. I didn't notice it :-(

@gaearon gaearon closed this as completed Sep 19, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jan 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants