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

Navigating back should retain the scroll position. #1182

Closed
krestaino opened this issue Jul 27, 2017 · 6 comments
Closed

Navigating back should retain the scroll position. #1182

krestaino opened this issue Jul 27, 2017 · 6 comments
Labels

Comments

@krestaino
Copy link

krestaino commented Jul 27, 2017

Version

1.0.0-rc3

Reproduction link

https://github.com/krestaino/scroll-position-nuxt

Steps to reproduce

  1. Go to http://localhost:3000/
  2. Scroll down and click on a post
  3. After the new page loads, use the browser's back button
  4. Scroll position goes to the top rather than where it was

What is expected?

Navigating back should retain the scroll position.

What is actually happening?

Navigating back does not retain the scroll position.

Additional Info

One thing I noticed, if I set the height of the HTML element to something like html { min-height: 10000px }, the issue goes away. It doesn't seem to be 100% consistent though. Is this happening because the post list is being rendered dynamically using v-for?

@existe-deja
Copy link

I've got the same issue and the same conclusion. The weird things is vue-router support the v-for elements. (I'm trying to use hash anchors in a v-for rendered list).

@existe-deja
Copy link

A temporary solution is to store the needed id when I click on a nuxt-router link, then on the mounted hook, scroll to the div with the needed id.

@pi0
Copy link
Member

pi0 commented Aug 14, 2017

Hi @krestaino. Thanks for your nice reproduce example. We are working on a fix ASAP. I'm closing all related issues to make issue tracking for 1.0 release easier. Feel free adding more comments or possibly help us for a fix PR.
Regards.

@pi0 pi0 closed this as completed Aug 14, 2017
@nathan5x-zz
Copy link

Any updates on the fix?

@krestaino
Copy link
Author

This was fixed with the 1.3.0 release.

@lock
Copy link

lock bot commented Nov 4, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 4, 2018
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants