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

scrollBehavior does not run on load #3196

Closed
Calvin-LL opened this issue May 13, 2020 · 1 comment · Fixed by #3199
Closed

scrollBehavior does not run on load #3196

Calvin-LL opened this issue May 13, 2020 · 1 comment · Fixed by #3199

Comments

@Calvin-LL
Copy link
Contributor

Calvin-LL commented May 13, 2020

Version

3.1.6

Reproduction link

https://codesandbox.io/s/vue-routing-example-pk4q2

Steps to reproduce

Load page

What is expected?

scrollBehavior always return { x: 0, y: 200 } so the scroll position should always be 200 pixels from the top

What is actually happening?

scrollBehavior always return { x: 0, y: 200 } but scroll position y is always 0 when first loaded

@Calvin-LL
Copy link
Contributor Author

posva added a commit that referenced this issue Jun 18, 2020
* Add handleScroll on initial history.transitionTo

* Update index.js

* test(scroll-behavior): add tests for scrollBehavior on load

* refactor(scroll-behavior): scrollBehavior on load

* style: remove spaces

* fix: handleScroll not called with from

* test(scroll-behavior): remove redundant tests

* fix: call handleScroll only if initial navigation succeeds

Co-authored-by: Eduardo San Martin Morote <posva13@gmail.com>
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

Successfully merging a pull request may close this issue.

1 participant