Subscribe on changes!

Text outside the `:global()` is ignored in scoped CSS

avatar
Sep 2nd 2022

Vue version

3.2.38

Link to minimal reproduction

https://sfc.vuejs.org/#eNqNkc9uwyAMxl/F45JVWsi6Y5ZW2m1vsAuXNHXaVIARJt2fKO8+k3ZTtdMOIPzZ389gJvUSgj6PqGrVcBeHkIAxjWFr/OACxQQTROxhhj6Sg0JKC+ON78hzAscH2OT8ffGK1hK8UbT7u2JlfFNdcAKSIKELtk0oEUBzXENnW+aNUR1JF48+lYti1HaaFuw8N9VxfakffBgTnEtHe7RikrwU5h43XAk5fVoE7ijgfnHqP3iYsgrQkyg8fGENT4/h4zmrc97yqg+Wdq2916GNv87Vf1jrG5a8P99mqx7UZZCla4M+MXkZ9WI114Q8uv6BGSUDzrFRx5QC11XFfZc/6MSa4qGSk46jT4NDjezKXaR3xihgo66dZzV/AyFzoeU=

Steps to reproduce

Using scoped style, define something like :global(.parent-class) .component-class. The generated CSS is missing wherever is outside the :global().

What is expected?

The generated CSS selector be .parent-class .component-class[data-v-472cff63]

What is actually happening?

The generated CSS selector is just .parent-class

System Info

No response

Any additional comments?

Not the same, but CSS Modules also have :global() and it allows to have an extra selector after it.

avatar
Sep 10th 2022

Just use .parent-class .component-class

——

Please, next time consider using the forum, the Discord server or StackOverflow for questions first. But feel free to come back and open an issue if it turns out to be a bug 🙂

avatar
Oct 11th 2022

That's not the same thing. If I just use .parent-class .component-class it defeats the purpose of using scoped CSS all together, possible causing naming collision and applying styles where it shouldn't.

avatar
Jun 22nd 2023

same trouble