Skip to content
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

[sfc] css in scoped pseudo-element is not handled #12241

Open
zyyv opened this issue Oct 23, 2024 · 1 comment · May be fixed by #12244
Open

[sfc] css in scoped pseudo-element is not handled #12241

zyyv opened this issue Oct 23, 2024 · 1 comment · May be fixed by #12244

Comments

@zyyv
Copy link

zyyv commented Oct 23, 2024

Vue version

latest

Link to minimal reproduction

https://play.vuejs.org/#eNp9Us1OwzAMfhUTDgU0rUJwGgUJEBJwAMRAXHKpWncrS+MoTmGo6rvjZOLnMO0Wfz/OZ8uDunRu+tGjmqmCK9+6AIyhdxfatp0jH2AAjw2M0HjqIBNppq22FVkO0PECziN/kN2iMQRv5E29lx1qW+SbdtJIioCdM2VAqQCK5TFUpmQ+16oh0upiGFKrcSzy5bFoivyfQUoOXwaBK3JYC5Ifwaul6/kcgi8tN9RhPYGakG0W4JP8CuAo13a/dA5mLR9M5ZvDIf5dkSE/k8j1mbZjbC7NJPUKmtZicgmQjNG0xZM0Ml2MJFnURAUJZpt2MX1nsrLIZNKqos61Bv2jC61sS6sZJCZypSzr8z5hwfc4+cGrJVarLfg7ryOm1ZNHRv+BWv1yofQLDBv6Zv6Aa3n/kh3VvRH1DvIZmUwfM25kV72tJfY/XUp7l86htYsXvlkHtPwzVAwalWPSayUncr1j9L+4J9PT5JOlqvEbS9HXeQ==

Steps to reproduce

  • Open playground, see not work
  • And toggle another css block, see work fine

What is expected?

Expected output

#app :is(.foo[data-v-xxx]){
  color: red;
}

or

#app[data-v-app] :is(.foo){
  color: red;
}

What is actually happening?

When vue style scoped is used with UnoCSS, and

presetUno({
  important: '#app',
}) 

is enabled, the unocss transformer will add a default prefix of #app to the css. Since #app is a special keyword, vue does not handle it specially. In style scoped mode, the elements in the pseudo-element are not hashed.

There is a minimal reproduction with UnoCSS https://stackblitz.com/edit/vitejs-vite-yzjmbw?file=src%2FApp.vue

System Info

No response

Any additional comments?

No response

@edison1105 edison1105 added scope: sfc 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. and removed scope: sfc 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Oct 23, 2024
@edison1105
Copy link
Member

edison1105 commented Oct 23, 2024

a workaround

:is(.foo){
  color: red;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants