Nuxt.js: Navigating back should retain the scroll position.

Created on 27 Jul 2017  路  6Comments  路  Source: nuxt/nuxt.js

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?

bug-confirmed help-wanted

Most helpful comment

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.

All 6 comments

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).

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.

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.

Any updates on the fix?

This was fixed with the 1.3.0 release.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikekidder picture mikekidder  路  3Comments

pehbehbeh picture pehbehbeh  路  3Comments

lazycrazy picture lazycrazy  路  3Comments

surmon-china picture surmon-china  路  3Comments

vadimsg picture vadimsg  路  3Comments