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

calculated scroll position is incorrect in some browser with animation #1530

Open
ytkj opened this issue Jun 21, 2017 · 1 comment
Open

calculated scroll position is incorrect in some browser with animation #1530

ytkj opened this issue Jun 21, 2017 · 1 comment

Comments

@ytkj
Copy link

ytkj commented Jun 21, 2017

Version

2.6.0

Reproduction link

https://jsfiddle.net/ykojima/krqwkfuy/

Steps to reproduce

  1. Run in jsFiddle
  2. Click "Foo" link
  3. Click "Go to Bar-2" link

What is expected?

change route to /bar and scroll to "Bar-2" h2 element.

In Chrome, it works fine.

What is actually happening?

change route to /bar, but scroll to the bottom of the page.

This happens in IE11, Firefox, Safari (Mac).


I think this problem cased by:

  • getElementPosition() is called with the timing at which both leaving route-component and entering route-component exist
  • window.scrollTo() method is called with the timing at which only entered route-component exist

https://github.com/vuejs/vue-router/blob/v2.6.0/src/util/scroll.js#L81

when animation is disabled ( or comment out <transition>), this problem does not happen.

@posva
Copy link
Member

posva commented Jun 21, 2017

Thanks for reporting this. I see it's kind of related to #1263 but a bit different

@posva posva changed the title calcurated scroll position is incorrect in some browser with animation calculated scroll position is incorrect in some browser with animation Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants