Skip to content

Conversation

@ramiy
Copy link
Contributor

@ramiy ramiy commented Nov 12, 2025

Summary

Firefox 146 added supports for @custom-media at-rule.

Feature information

Browsers support

Related issues

Last year I added this feature to BCD - #24338

But because no browsers implemented it yet, the feature was deleted - #25125

Now that Firefox implemented this, we can add it back to BCD.

@github-actions github-actions bot added data:css Compat data for CSS features. https://developer.mozilla.org/docs/Web/CSS size:m [PR only] 25-100 LoC changed labels Nov 12, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just two nits.

ramiy and others added 2 commits November 12, 2025 03:27
Co-authored-by: Claas Augner <495429+caugner@users.noreply.github.com>
Co-authored-by: Claas Augner <495429+caugner@users.noreply.github.com>
@caugner caugner changed the title feat(css): Add browser compatibility data for the CSS @custom-media at-rule Firefox 146 adds CSS @custom-media at-rule behind flag Nov 12, 2025
@caugner caugner merged commit 2395ce9 into mdn:main Nov 12, 2025
6 checks passed
@ramiy ramiy deleted the custom-media-queries branch November 12, 2025 11:35
@caugner caugner mentioned this pull request Nov 12, 2025
caugner added a commit that referenced this pull request Nov 17, 2025
* Firefox 146 adds `CSSCustomMediaRule` API behind flag

Relates to #28438

This PR adds `CSSCustomMediaRule` API.

Ref:
* mozilla-firefox/firefox@f289eebba919#diff-5344d883f252f0d0fcde1443e722366428c6dec715f2dfa5a910d6d4fd088ce2
* https://bugzilla.mozilla.org/show_bug.cgi?id=1744292

---------

Co-authored-by: Claas Augner <495429+caugner@users.noreply.github.com>
"chrome_android": "mirror",
"edge": "mirror",
"firefox": {
"version_added": "146",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really work? I tested it and it didn't work.

data:text/html;charset=UTF-8,<!DOCTYPE html>
<style>
@custom-media --foo (width > 0px);

@media (--foo) { 
  div {
    background: green;
    width: 200px;
    height: 200px;
  }
}
</style>
<div>This should be a green background.</div>
Image

Copy link
Contributor

@yisibl yisibl Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emilio Given bug 2004653 (landed in Firefox 148), this feature actually doesn't work in Firefox 146. Will you backport it to Firefox 146?

Otherwise, all relevant MDN docs must be modified.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yisibl Since the feature is behind a flag, the fix probably won't be backported. If you like, you can open a PR correcting the version number, but once the feature ships in Firefox Stable, the flag entry will be removed anyhow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caugner Okay, I recommend that for new features going forward, a demo must be provided for verification before merging pull requests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A demo doesn't prove the absence of major bugs. In general, when features are behind a flag, they are not stable, so bugs are expected.

Note that the majority of BCD features is covered by the MDN BCD Collector, which supports custom tests for cases like this, where a test case cannot be derived from the spec. However, we only run the MDN BCD Collector on Beta releases without any flags enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:css Compat data for CSS features. https://developer.mozilla.org/docs/Web/CSS size:m [PR only] 25-100 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants