Use container queries to style descendants of containers based on their scroll state. The query container is either a scroll container, or an element affected by the scroll position of a scroll container. The following states can be queried: - Whether a sticky positioned container is stuck to one of the edges of the scroll box (stuck) - Whether a scroll snap aligned container is currently snapped horizontally or vertically (snapped) - Whether a scroll container can be scrolled in a queried direction (overflowing) A new container-type:scroll-state is introduced to allow such containers to be queried. For instance: #sticky { position: sticky; container-type: scroll-state; } @container scroll-state(stuck: top) { #sticky-child { font-size: 75% } }
Risk: none of the other vendors have committed to implement yet.
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
None
- Elements are marked with a "container" badge for scroll-state as for size containers - @container rules in matching styles have a link back to the container element as for size containers - No further support as of now. Future improvements could be - Having an indication of container type in the element badge - Some indication along with the query which feature is matched with which value
https://wpt.fyi/results/css/css-conditional/container-queries/scroll-state
Shipping on desktop | 133 |
DevTrial on desktop | 116 |
Shipping on Android | 133 |
DevTrial on Android | 116 |
Shipping on WebView | 133 |
Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).
NoneFour issues are opened against the spec:https://github.com/w3c/csswg-drafts/issues/11181
https://github.com/w3c/csswg-drafts/issues/11182
https://github.com/w3c/csswg-drafts/issues/11183
https://github.com/w3c/csswg-drafts/issues/11127The one that's blocking shipping is the potential renaming from 'overflowing' to 'scrollable': https://github.com/w3c/csswg-drafts/issues/11182
Two of the others are convenience keyword additions, and the last one is a non-behavioral editorial change to the spec.
Does this integrate with scroll timelines and animations at all?
LGTM1
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACuPfeSqvXZcGbJwczY_anrcTuN2_2Sd19ALKjtLq7am-P7wzw%40mail.gmail.com.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/a02ee4a6-8ec9-44aa-ae1a-c3cdc54db67a%40chromium.org.
LGTM3Is anyone looking into why the tests have harness errors on non-chromium browsers? Is that a bug in the test failing to fail properly?
On Wed, Nov 27, 2024 at 4:49 PM Rick Byers <rby...@chromium.org> wrote:LGTM3Is anyone looking into why the tests have harness errors on non-chromium browsers? Is that a bug in the test failing to fail properly?The issue is that I use assert_implements() for container-type:scroll-state in the setup() function as it makes no sense to continue without it, and to make sure there are no false positives in subtests. But consulting the wpt documentation it seems I need to repeat that in every single subtest instead. It would be convenient to have some pre-condition check in setup() that causes every subtest to fail instead of causing a harness error.
On Fri, Nov 29, 2024 at 5:02 AM Rune Lillesveen <fut...@chromium.org> wrote:On Wed, Nov 27, 2024 at 4:49 PM Rick Byers <rby...@chromium.org> wrote:LGTM3Is anyone looking into why the tests have harness errors on non-chromium browsers? Is that a bug in the test failing to fail properly?The issue is that I use assert_implements() for container-type:scroll-state in the setup() function as it makes no sense to continue without it, and to make sure there are no false positives in subtests. But consulting the wpt documentation it seems I need to repeat that in every single subtest instead. It would be convenient to have some pre-condition check in setup() that causes every subtest to fail instead of causing a harness error.Interesting, thanks for looking into it. Feel free to file a WPT bug for improving the infra (/cc @Panos Astithas).