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

When there is multiple scroll-start-targets,  can we let the author choose the selection mechanism?

Say that we had a property called `scroll-start-target-selection` with possible values `['safe' | 'unsafe']? && ['first' | 'last']`. `first` and `last` would select the first or last start target in DOM order, while `safe` would make a start-target invalid if scrolling to that start-target would result in a previous start-target being partially or fully scrolled out of the scrollport. 

One use case is a scroll snap image gallery. 

If the container is narrow, you’d want to start at the snap position of the first image. But, if the scrollport have space enough, you’d want to start at the snap position of the second image so that more images are visible from the start. 


```css

.snap-scroll-inline {
  overflow-inline: scroll;
  scroll-snap-type: inline mandatory;
  scroll-start-target-selection: safe last;
}

.snap-scroll-inline > :nth-child(-n+2) {
  scroll-start-target-inline: auto;
}

```

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


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

Received on Sunday, 16 April 2023 18:00:45 UTC