zefoy / ngx-perfect-scrollbar

Angular wrapper library for the Perfect Scrollbar
MIT License
521 stars 116 forks source link

Glitches on route transition #258

Open Nyconing opened 5 years ago

Nyconing commented 5 years ago

Afaik, perfect-scrollbar rely on activated component because it triggers a lot of events and everything are controlled by running codes include scroll-state.

Unfortunately, Angular's route transition doing animation by deactivating the component before :leave animation, this cause all of the perfect-scrollbar reseted to x0 y0 scroll position.

Nyconing commented 5 years ago

Reproducing:

  1. Find an route transition example taken from google.
  2. Add perfect-scrollbar on it.
  3. Observe the glitches by jump route after scrolled.

I have done: https://stackblitz.com/edit/angular-nhoplx

Edit: I have found another scrollbar ngx-scrollbar without glitches (may help to eliminate glitches) Reproduce it with same way: https://stackblitz.com/edit/angular-1z7qxn

sconix commented 5 years ago

This is just a wrapper for the PS and its a traditional JS library so it won't play that nice with all Angular features. So if you want to keep the scroll position on route transitions you need to implement that yourself, PS won't provide such feature.