You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems to work in both firefox and chrome for us if we want to scroll to the start of the body for example. But both in edge and safari the frames array is always empty if we use document.body as a target
The text was updated successfully, but these errors were encountered:
Yeah that's because in those browsers the body is the scrolling element. You can verify this by checking document.scrollingElement.
The reason why it works firefox and chrome is that document.documentElement/<html> is the scrolling element there.
If you use the native scrollIntoView method on your usecases does it work then? Just so we can determine wether scrolling with document.body is a behavior that should work as in chrome when you're in other envs.
Thanks for clearing that up, did not know that. In the end i fixed it by adding an invisible anchor element at the beginning of the body.
I just tested in safari and there using the native element scrolls to the beginning of the body as intended. I could not test on edge as i only have the new chrome based edge on hand currently
Yeah it caught me off guard as well. I discovered it while working on Browserstack tests.
I got some time to look into this some more earlier this evening. I noticed that when you call document.scrollingElement.scrollIntoView() in both Safari and Chrome they both scroll the page to the top. What you discovered is definitely what I'd classify as a bug.
I plan on implementing scroll-margin and scroll-padding support next, as these properties are no longer exclusive to scroll-snap logic but also affect scrollIntoView and page fragment scrolling in firefox and chrome betas. It's going to take time to implement this spec, thus I'll mark this as a "good first issue" and leave it open to signal to the community that PRs are welcome 😄
It seems to work in both firefox and chrome for us if we want to scroll to the start of the body for example. But both in edge and safari the frames array is always empty if we use document.body as a target
The text was updated successfully, but these errors were encountered: