scroll-into-view/compute-scroll-into-view

Question about current status of scroll-padding / scroll-margin

floer32 opened this issue · 2 comments

I saw this mentioned in an earlier issue (#292):

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.

And I gather that explicit support has not been implemented yet, based on searching the source code.

I noticed that, without the polyfill, I can use .scrollIntoView in Chrome (just without the if-needed option), and it's working as I expect, taking scroll-padding-top into account. So my solution for now is: in Chrome, just call that native method, but if we are in Safari/Edge (or if that method had an error), it uses this polyfill (even though some content will be covered by the fixed header, since scroll-padding/scroll-margin is not accounted-for yet).

Is that basically the right idea in the meantime?

would also like to see support for scroll-padding and scroll-margin