janpaul123 / delayed-scroll-restoration-polyfill

Polyfill that mimics Chrome's scroll restoration behavior.
Other
105 stars 8 forks source link

URL Redirect Instead of Browser Back Button Press #5

Open maks-humeniuk opened 6 years ago

maks-humeniuk commented 6 years ago

Hi there.

First of all, thanks for the polyfill. Though, I have a question regarding its work.

Say, we have two pages: A (with vertical scrollbar) and B. We scroll down on A and then redirect to B (by using button click, which calls Angular Router.navigate() method). Then we press browser Back button - scroll position restores as expected. But if we back from B to A not by using browser Back button, but with URL redirect (by using click in breadcrumbs), then scroll doesn't restore.

The question is: is it by design or is it an issue? In any case, is there any way to achieve needed behavior with your polyfill?

Thanks in advance.

trotzig commented 6 years ago

I'll let @janpaul123 chime in here, but I feel like that's a different case, best handled in your application.

janpaul123 commented 6 years ago

What does Google Chrome do in your scenario? This is intended as a polyfill for Chrome's behaviour.

maks-humeniuk commented 6 years ago

Without the polyfill it scrolls to the top in both cases.