Intent to prototype and ship: Size container queries

Skip to first unread message

Emilio Cobos Álvarez

Jan 11, 2023, 3:56:41 PM1/11/23
(Apparently I missed sending the intent to prototype, whoops)

As of real soon (as soon as the patch is r+'d), I intend to turn our
container query implementation on by default on all platforms. It's been
enabled on Nightly for a long while already, and fuzzed as well.

It has been developed behind the layout.css.container-queries.enabled
preference and other browsers ship a similar subset of the spec (which
is fairly stable).

Bug: <>

Bug to turn on by default: <>


Specification: <>

Standards Body: CSSWG (W3C)

Platform coverage: All

Preference: layout.css.container-queries.enabled

DevTools bug: <> and related.

Other browsers:

* Chromium: Shipped since M106
* Safari: Shipped since Safari 16


Note that there are tests for style() queries that aren't part of this
etc, but in general I think we're in good shape.

A few of our failures wrt Shadow DOM are known, and our current behavior
seems preferable (IMO) and not likely to run into interop issues. It's
not hard to fix if we find them tho. See all the discussion in
<> and

Let me know if there's any concern.

-- Emilio

Geoff Lankow

Jan 15, 2023, 4:32:55 PM1/15/23
to, Emilio Cobos Álvarez
Hi Emilio.

I can see this is going to be really useful! I've already made one patch for Thunderbird using it.
Is there going to be a matchMedia equivalent for containers? And if an element is defined as a container, could there be an event when the element is resized (to any size, not just predefined ones)?


Emilio Cobos Álvarez

Jan 15, 2023, 10:50:48 PM1/15/23
to Geoff Lankow,
There's no JS API equivalent to matchMedia, see <>.

Similarly, there's no event, but there is ResizeObserver, would that not work for your use case? If not, why not?

 -- Emilio

Geoff Lankow

Jan 15, 2023, 11:01:37 PM1/15/23
to Emilio Cobos Álvarez,

Huh! I didn't know ResizeObserver was a thing, and it's been around for ages too. It will do the job nicely. Thanks!

Reply all
Reply to author
0 new messages