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:flexwould not generate anything because the/namemodifier belongs to thenotvariant, and not the compoundedgroup-hovervariant.This PR is a workaround (and definitely not perfect) by special casing the
not,has, andinvariants such that their modifiers are moved internally to the sub variant as-if the/nameexisted ongroup-hover.We don't do it for other compound variants such as
groupandpeerbecause thengroup-peer-focus/name:underlinewould 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, andincode that handles these variants, but we handle the variants in a depth-first way, so by the time you are handling thenotvariant, the sub variant was already handled...In a perfect world, you can use something like
not-group/name-hoverbut then it becomes unambiguous because isnamethe name, isname-hover?Test plan
Added a new test that wouldn't generate anything before this fix.
Fixes: #15772