-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
CSS direct descendant wildcard rule no longer applied to child components #13387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
related PR #12918 |
Due to the PR, the generated CSS changed semantics, which looks like a bug in the implementation to me. Before the change, your compiled CSS looked like this: main {
> *[data-v-7ba5bd90] {
/* */
}
} After the change, it became main {
[data-v-7ba5bd90]> [data-v-7ba5bd90] {
/* */
}
} So effectively it's For your case specifically, changing your css into main {
& > * {
/* ^
* Notice the '&' here */
}
} will fix it, as that will turn your compiled CSS into main {
&[data-v-7ba5bd90]> [data-v-7ba5bd90] {
/* */
}
} and then See also https://vuejs.org/api/sfc-css-features#deep-selectors, which is related but not the cause of your issue. |
Because my other issue was closed as a duplicate of this one, I want to highlight another edge case that's in the closed issue but isn't presented here: the fix changed specificity when using wildcards, which goes against the CSS spec: <style scoped>
#app > :first-child {
background: purple;
}
#app > * {
background: green;
}
</style> In Vue 3.5.14, the first declaration has a higher specificity than the second. |
closed via #13406 |
Vue version
3.5.15
Link to minimal reproduction
https://play.vuejs.org/#eNp9Um1LwzAQ/ishIIK4dnPuSx0DlYEKvqB+DEhtb122NglJunWM/XcvyTo7USEf7u65lyd3z5ZeKxWtaqAJHZtMc2WJAVurCRO8UlJb8ri5lWgJEJbMtKzIaRR3Yq74lIlxHKqxDh0LlSpTC+gRMq5SLryFdrdbHOB4j4/jThm6xm5KICaTCnKMuCyydRU5N5i2ScishObKRZzRy7mGzHIpEpLJsq6Ehz7TbFloWYs8IRsoS7kuNEDA1jy384QM+v0T70/IWZhASJU2vT180e+rMKbbrYczpG57enjHBD7chCOOjOk5tUhfzHgRLYwUuGPfndEMd8BL0M/K8TWMJu1cRlPX78HHrK7hvI1nc8iWv8QXpnExRl80GNArYPSA2VQXYAM8fXuCBu0DWMm8LjH7H/AVDG7ScQxpN/hxpN3J82zvvVK4KN7NtLEgTPspR9Rvxuczilpx5//r6990h9Flu1Hc4g+5Oa0eKyznq73A7tw59kcJ6grYkbiw5ccKtKOJvYbRKBqM6O4Lhn0ERA==
Steps to reproduce
The Vue issue helper doesn't seem to create issues, so I have to fill this form manually.
Steps to reproduce:
Create a component with a scoped style block having a CSS rule affecting its direct descendants with a wildcard rule, such as:
What is expected?
CSS rule is applied to children, as it does in 3.5.14.
What is actually happening?
CSS rule is not applied to children after 3.5.15. If I remove the direct descendant arrow, or replace the wildcard with div, the example works again.
System Info
Any additional comments?
If this is by design, then my own interpretation is flawed, apologies in advance.
The text was updated successfully, but these errors were encountered: