Skip to content

[mediaqueries-5] Defining @custom-media inside conditional at-rules #12536

@tursunova

Description

@tursunova

Currently Media Queries Level 5 spec allows custom media queries to be defined within other at-rules, including conditional rules like @media. This creates a logical paradox where a custom media query can be used in a condition before it has been defined, leading to a circular dependency that cannot be resolved. For example:

@media (color) and (--custom) {
  @custom-media --custom (max-width: 300px);
  ...
}

Proposing to explicitly disallow @custom-media rules from being defined inside any conditional group rules (e.g., @media, @supports), attempting to use @custom-media inside conditional at-rules will make custom media queries fail to be defined.

CC: @tabatkins @emilio

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Wednesday Morning

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions