Skip to content

Apply style rules inside true @supports blocks - #275

Merged
eXpl0it3r merged 1 commit into
masterfrom
fix/supports-rules
Nov 10, 2026
Merged

eXpl0it3r merged 1 commit into
masterfrom
fix/supports-rules

Conversation

@eXpl0it3r

Copy link
Copy Markdown
Collaborator

Style rules inside an @supports block never applied, no matter what the condition evaluated to. With @supports (display: block) { p { color: red } } the paragraph stayed black, while the same rule inside @media screen worked. The rule index in CssData only descended into @media, @layer and nested style rules and silently skipped @supports, even though FlattenRules right above it already handled it.

IndexRules now evaluates the @supports condition and indexes the inner rules when it's true. The condition doesn't depend on the viewport, so it's decided once while building the index, and nested @media blocks inside it keep their media matching as before. This also covers @supports inside @layer and nested @supports/@media combinations. What a condition evaluates to isn't touched, e.g. animation-name is still reported as supported, so the ported SupportsNot_Fallback_Applies_WhenFeatureIsUnsupported test stays ignored for that reason.

How to test this PR?

CI should succeed. The tests in ConditionGroupingRuleIntegrationTests cover true and false conditions, not, nesting with @media and @supports inside @layer, and the ones expecting the inner rules to apply fail on master.

@eXpl0it3r
eXpl0it3r merged commit 89713d9 into master Nov 10, 2026
18 checks passed
@eXpl0it3r
eXpl0it3r deleted the fix/supports-rules branch November 10, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant