Open flackr opened 10 months ago
Small correction - the interop 2022 failures are scroll-target-snap-001.html
and scroll-target-snap-002.html
. These are snap containers (with proximity snapping). Chrome gives precedence to (default) ScrollIntoViewOptions over (explicit) scroll-snap-align
. But on this point I observe that the Scroll Snap spec is in contradiction to the CSSOM View spec (re. how to "scroll a target into view"); we can't satisfy them both as written.
The tests scroll-target-align-001.html
and scroll-target-align-002.html
are also failing in Chrome but not tagged with interop 2022. These are the ones testing what the Scroll Snap spec declares to be optional behavior around honoring scroll-snap-align
in NON-snapping containers (scroll-snap-type: none
).
css-scroll-snap-1 6.2 Choosing Snap Positions says the following:
While working on this, the question came up of how to respect the alignment if the developer provided one. E.g. if the developer specifies a block alignment:
What should we do if the target element has a non-none
scroll-snap-align
:scroll-snap-align
value. This seems reasonable as not doing so could result in the element not being visible. E.g. see degenerate case mentioned in https://github.com/w3c/csswg-drafts/issues/9012#issuecomment-1749344005scroll-snap-align
alignment it seems like it would have to always override the javascript provided alignment.Having a CSS value override the JS one, especially when it's optional, seems like it runs counter to developer expectations - e.g. confusion around why the provided alignment wasn't used.
Another concern is that currently scrolling to a fragment also specifically invokes Scroll target into view, with behavior set to "auto", block set to "start", and inline set to "nearest" so it currently has a specified alignment, even though the developer did not provide it.
TLDR; There are a few questions around this space:
scroll-snap-align
value if specified, and otherwise fall back to defaults.