Move modifier of not-*
, has-*
, and in-*
variant to sub variant
#19100
+32
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where a compound variant with a modifier such as
not-group-hover/name:flex
would not generate anything because the/name
modifier belongs to thenot
variant, and not the compoundedgroup-hover
variant.This PR is a workaround (and definitely not perfect) by special casing the
not
,has
, andin
variants such that their modifiers are moved internally to the sub variant as-if the/name
existed ongroup-hover
.We don't do it for other compound variants such as
group
andpeer
because thengroup-peer-focus/name:underline
would result in a breaking change:In case the diff is not clear, the name has moved:

This is also a limited workaround, because if you need multiple modifiers it won't work. I would've loved to special case this inside the
not
,has
, andin
code that handles these variants, but we handle the variants in a depth-first way, so by the time you are handling thenot
variant, the sub variant was already handled...In a perfect world, you can use something like
not-group/name-hover
but then it becomes unambiguous because isname
the name, isname-hover
?Test plan
Added a new test that wouldn't generate anything before this fix.
Fixes: #15772