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

Another detail of scrollBehavior wrapped in transition #1373

Closed
nickforddev opened this issue Apr 25, 2017 · 9 comments
Closed

Another detail of scrollBehavior wrapped in transition #1373

nickforddev opened this issue Apr 25, 2017 · 9 comments

Comments

@nickforddev
Copy link

Version

2.5.2

Reproduction link

http://jsfiddle.net/xctnu8r3/2/

Steps to reproduce

Wrapping a router-view in a 2-way transition (like a fade), and scrollBehavior returns { x: 0, y: 0 }.

Click Post 1, scroll down just a little, then click Home.

What is expected?

Scrolling shouldn't take place until after the in-out transition has completed.

What is actually happening?

The router-view scrolls to the top immediately, before the transition begins, resulting in an undesirable content flicker (which looks much worse in a real scenario with actual content).

@posva
Copy link
Member

posva commented Apr 26, 2017

Fixing this should also fix #1263

@jvandenaardweg
Copy link

Experiencing the same problem as described above

@purepear
Copy link

me too

@purepear
Copy link

purepear commented Jul 2, 2017

i ended up using transition hook :)

transition(name="fade", mode="out-in", appear, @after-leave="afterLeave")
methods: {
  afterLeave (el) {
    window.scroll(0, 0)
  }
}

@atinux
Copy link
Contributor

atinux commented Jul 4, 2017

I think this shows a little bit more the issue: http://jsfiddle.net/9hvo46o1/1/

@purepear
Copy link

purepear commented Jul 4, 2017

@atinux
Copy link
Contributor

atinux commented Jul 4, 2017

@purepear it's a temporary solution and I'm looking for a permanent solution for Nuxt.js without any hacks.

@purepear
Copy link

purepear commented Jul 4, 2017

Hi @atinux I've never used Nuxt so i'm not familiar with the problem there but transition and router-view are part of different libraries and i'm not sure if coupling things will be good. Hooks don't seem so hackish/temporary to me .. that's what they are made for :) ... but again .. i'm not familiar with Nuxt

@posva
Copy link
Member

posva commented Jul 9, 2017

Closing as dup of #1263

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

5 participants