Re: [csswg-drafts] [css-scroll-snap] Support scroll-padding on all elements. (#7931)

> > I propose that if we supported (and accumulated) scroll-padding and scroll-margin from all elements between the target and the scrolling container [...]
> 
> `scroll-padding` applies to the scroll container, not to the individual elements, so I don't understand how accumulating it makes any sense...? If you want per-element padding, use `scroll-margin`.

This padding conceptually should be added inside the scrollport box not expanding the target edges - hence why I think padding makes more sense. That said, I think the math works out the same either way so if I'm the minority on this POV we can go with margin.

> Wrt accumulating scroll-margin, this would not give good results on e.g. nested sections. Consider a document which has `section { scroll-margin: 1em; }` and the TOC links to its corresponding section elements. If we accumulated `scroll-margin`, a section nested three levels deep would have 3em of scroll margin, which is too much.

If you only need 1em of scroll margin then only the top section should add scroll-margin. However, if the top section needs 1em of scroll-margin, then scrolling anything within it should also need 1em of scroll margin.

> > however, if you scroll down and type into the input box the browser tries to scroll it into view (which should scroll it into the optimal viewing region). This results in each keypress scrolling up.
> 
> I think a reasonable thing to do here would be to except fixed and sticky elements from trying to honor scroll-padding / scroll-margin. (For stickypos, probably we'd want it to take the minimum of the scroll-margin and the sticky offset.)

This causes bugs when you have sticky elements which are occluded by other sticky or fixed pos headers where the scroll margin was intentional to ensure they avoid those headers.

-- 
GitHub Notification of comment by flackr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7931#issuecomment-1339588585 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 6 December 2022 15:53:53 UTC