Re: [csswg-drafts] [css-scroll-snap-2] Should scroll-start-target specify alignment? (#9012)

I think we should consider a more generic mechanism for all operations which attempt to scroll a particular fragment into view. E.g. similar to how [scroll-behavior](https://drafts.csswg.org/css-overflow/#smooth-scrolling) sets the default behavior (smooth or instant, see [example](https://jsbin.com/zexuxeg/edit?html,css,js,output)) and can be overridden by the [scrollintoview behavior](https://drafts.csswg.org/cssom-view/#dom-scrolloptions-behavior).

When there is a specified `scroll-snap-align` value we should be using that alignment, as [best case we will scroll to that alignment anyways](https://jsbin.com/jahetux/edit?html,css,output), but [worst case scroll snap may move away from the scrolled to element](https://jsbin.com/duvikop/edit?html,css,output) due to another snap point being closer to the scroll position.

So putting all of this together, I think this might be something like,
`scroll-align: [normal | snap]? [ start | end | center ]{1,2}`

Where this specifies the alignment to be used for scrolling operations targeting the element (scroll-start, anchor navigation, etc).

And then specifying a non-none value for `scroll-snap-align` could set the scroll align type to snap?


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


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

Received on Thursday, 5 October 2023 17:20:34 UTC