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

fix(vue-app): use browser to handle scrolling position on page reload #5080

Merged
merged 1 commit into from Feb 25, 2019

Conversation

Projects
None yet
6 participants
@ahus1
Copy link
Contributor

ahus1 commented Feb 20, 2019

also for cases when returning to a nuxt site using a back button.

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

When leaving the page, the scrollRestoration is restored to 'auto', as this will instruct the browser to memorize the scroll position. vue-router will not restore the scroll position on page reload and when navigating back from a different page.

It solves the problem that the browser scrolls to the top when reloading a Nuxt page, as seen in Chrome for example with https://blog.lichter.io/.
Steps to reproduce: go to nuxt site, scroll down, press F5, browser will be at top of page and not at original scrolling position as expected.

Resolves #3471

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
    (this fixes a browser scrolling issue on full page reload, I assume this can't be tested automatically)
  • All new and existing tests are passing.

@galvez galvez requested a review from nuxt/core-team Feb 21, 2019

@manniL

This comment has been minimized.

Copy link
Member

manniL commented Feb 21, 2019

From Alex to Alex: Well done and thanks for the contribution 👏 Greetings to Frankfurt! ☺️

@manniL

manniL approved these changes Feb 21, 2019

@manniL manniL requested a review from pi0 Feb 21, 2019

@galvez

galvez approved these changes Feb 25, 2019

@manniL manniL referenced this pull request Feb 25, 2019

Closed

chore(release): v2.4.4 #5109

@Atinux Atinux merged commit f3a4d6c into nuxt:dev Feb 25, 2019

10 checks passed

Semantic Pull Request ready to be squashed
Details
[ci.azure] nuxt.js #20190221.4 succeeded
Details
ci/circleci: audit Your tests passed on CircleCI!
Details
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: lint-app Your tests passed on CircleCI!
Details
ci/circleci: setup Your tests passed on CircleCI!
Details
ci/circleci: test-e2e Your tests passed on CircleCI!
Details
ci/circleci: test-types Your tests passed on CircleCI!
Details
ci/circleci: test-unit Your tests passed on CircleCI!
Details

@pi0 pi0 changed the title fix: use browser to handle scrolling position on page reload fix(vue-app): use browser to handle scrolling position on page reload Feb 25, 2019

pi0 added a commit that referenced this pull request Feb 25, 2019

pi0 added a commit that referenced this pull request Feb 26, 2019

@husayt

This comment has been minimized.

Copy link
Collaborator

husayt commented Feb 26, 2019

This was really needed. Thanks

@pi0

This comment has been minimized.

Copy link
Member

pi0 commented Feb 26, 2019

This fix is available on nuxt 2.4.5

@ahus1 ahus1 deleted the ahus1:fix_scrolling_position_on_reload_and_back_navigation branch Feb 28, 2019

@pi0 pi0 referenced this pull request Mar 14, 2019

Merged

v2.5.0 #5237

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.