jonaskuske / smoothscroll-anchor-polyfill

⚓ Apply smooth scroll to anchor links, polyfill scroll-behavior
https://jonaskuske.github.io/smoothscroll-anchor-polyfill
MIT License
41 stars 3 forks source link

window.scrollTo with behavior: 'smooth' doesn't scroll to the top of the page with safari #38

Closed ieozt38 closed 4 years ago

ieozt38 commented 4 years ago

On Safari code below doesn't scroll to the top of the page however on other browsers it does. When I delete smooth-scrolling, it scrolls back to the top. (Angular 10) script added in index.html.

       window.scrollTo({
          behavior: 'smooth',
          top: 0,
          left: 0,
        }); 
jonaskuske commented 4 years ago

Couldn't reproduce this - might be caused by some CSS that makes <body> scrollable instead of <html>?

Anyway, you'll need to file your issue over at iamdustan/smoothscroll, this library here is just concerned with calling the scroll APIs in the right moments (clicks on anchors, forwards/backwards nav...), not with the scroll implementation itself. :)