Re: [csswg-drafts] [css-overflow] Proposing `scroll-start`: allowing overflow scroll to not always start at 0 on 1st layout pass (#6986)

> to me though, sounds like container queries are the perfect way to handle this:


Container queries can definitively be used to handle this in many cases. However it requires that you know the approximate size and scroll snap alignment of the target elements, and possibly the scroll padding and margins as well. 

Say that you have a user editable gallery, where users can add images of any aspect-ratio. The images are sized so that that have the same area, so that a 16:9 and a 9:16 image are the same “size”. 

The only way to know if you can safely scroll to the second image is to calculate all the snap positions, and check them against the border-box of the first image to see if it is partly or fully scrolled out of the scroll container. 

I quite like how ‘overflow-position’ in css-align-3 works, and would love a similar approach here: Try to align the initial scroll with the last scroll-start-target, but only if it can be done without obscuring any previous elements. 



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


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

Received on Monday, 17 April 2023 16:58:23 UTC