compute-scroll-into-view icon indicating copy to clipboard operation
compute-scroll-into-view copied to clipboard

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

Open floer32 opened this issue 2 years ago • 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?

floer32 avatar Jun 26 '22 22:06 floer32

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

jknight12882 avatar Aug 03 '22 01:08 jknight12882

Adding some context, these are the tests that needs to be added, and the implementation need to pass:

  • https://github.com/web-platform-tests/wpt/blob/3428426669666600429687c1cfb708cefd8cc79b/css/cssom-view/scrollIntoView-scrollPadding.html

  • https://github.com/web-platform-tests/wpt/blob/3428426669666600429687c1cfb708cefd8cc79b/css/cssom-view/scrollIntoView-scrollMargin.html

stipsan avatar Nov 30 '22 23:11 stipsan