You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-mixins-1] Are @mixin rules valid within other at-rules? #12417
In other words, does the above @apply rule "remember" that the referenced mixin is enclosed by an @container? Any decision we make should hopefully answer the same question about @layer, @starting-style, etc.
My initial thought is that (for simplicity) we should make @mixin invalid within any at-rule except conditional rules with the "old school" processing model (i.e. currently @media and @supports).
My initial thought is that (for simplicity) we should make @mixin invalid within any at-rule except conditional rules with the "old school" processing model (i.e. currently @media and @supports).
I somewhat agree with this.
But I think mixin rules should also be valid in @layer rules to be able to use cascade layers to resolve name conflicts.
However the inner styles should not be affected by this I think.
I would expect :root to have colorgreen in this example:
But I think mixin rules should also be valid in @layer rules to be able to use cascade layers to resolve name conflicts.
Ah, yeah, you're right. Damn. I was hoping we could just cleanly state "doesn't work (at all) within such and such", but I guess we do need to be more subtle about it---at least for @layer.
However the inner styles should not be affected by this I think.
Hopefully it will still be somewhat explainable to authors that layers affect which mixin definitions "wins", but not the definitions themselves.
This also raises some questions about the declared layer order.
Do @layer rules inside mixins affect the layer order?
Or only when those mixins are applied?
I don't think we need any normative changes for validity of @keyframes. I think it was just cited as an example of "unless otherwise specified, an at-rule is valid at the top level, and in select other circumstances," and the sections I linked to define those other circumstances.
Activity
romainmenke commentedon Jun 30, 2025
I somewhat agree with this.
But I think mixin rules should also be valid in
@layerrules to be able to use cascade layers to resolve name conflicts.However the inner styles should not be affected by this I think.
I would expect
:rootto havecolorgreenin this example:Authors can also layer inner styles by writing:
andruud commentedon Jun 30, 2025
Ah, yeah, you're right. Damn. I was hoping we could just cleanly state "doesn't work (at all) within such and such", but I guess we do need to be more subtle about it---at least for
@layer.Hopefully it will still be somewhat explainable to authors that layers affect which mixin definitions "wins", but not the definitions themselves.
romainmenke commentedon Jun 30, 2025
This also raises some questions about the declared layer order.
Do
@layerrules inside mixins affect the layer order?Or only when those mixins are applied?
Support mixins across stylesheets.
Support mixins across stylesheets.
Support mixins across stylesheets.
Bug 1975722 [wpt PR 53594] - Support mixins across stylesheets., a=te…
Bug 1975722 [wpt PR 53594] - Support mixins across stylesheets., a=te…
Revert "Support mixins across stylesheets."
Revert "Support mixins across stylesheets."
Revert "Support mixins across stylesheets."
Bug 1976541 [wpt PR 53684] - Revert "Support mixins across stylesheet…
47 remaining items
Bug 2056398 [wpt PR 61427] - [css-mixins] Test that @layer is dropped…
[css-mixins-1] Make @layer invalid within a mixin body. w3c#12417
kbabbitt commentedon Sep 29, 2026
I don't think we need any normative changes for validity of
@keyframes. I think it was just cited as an example of "unless otherwise specified, an at-rule is valid at the top level, and in select other circumstances," and the sections I linked to define those other circumstances.[css-mixins] Test that @mixin is valid wherever @Keyframes is valid
[css-mixins] Test that @mixin is valid wherever @Keyframes is valid
Bug 2077396 [wpt PR 63177] - [css-mixins] Test that @mixin is valid w…
[css-mixins-1] Make @layer invalid within a mixin body. #12417
Bug 2056398 [wpt PR 61427] - [css-mixins] Test that @layer is dropped…