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

[css-shadow-parts-1] vendor prefixed pseudo elements support #4530

Open
liamdebeasi opened this issue Nov 22, 2019 · 2 comments
Open

[css-shadow-parts-1] vendor prefixed pseudo elements support #4530

liamdebeasi opened this issue Nov 22, 2019 · 2 comments

Comments

@liamdebeasi
Copy link

As per the spec, the ::part() pseudo-element can take additional pseudo-elements after it such as ::before (source: https://drafts.csswg.org/css-shadow-parts/#part).

Does this extend to vendor-prefixed pseudo-elements as well? The current behavior in Chrome and the latest Safari Tech Preview (96 as of writing) is that prefixed pseudo elements do not work with shadow parts.

Example: https://codepen.io/liamdebeasi/pen/jOOpQKa

I'm wondering if this is just a browser bug, or maybe a part of the spec that just needs clarification. Thanks!

@Offroaders123
Copy link

I recently ran into this issue too, and I was wondering if we know whether support for it will be added at some point?
Thanks!

@tabatkins
Copy link
Member

Undefined, basically by definition - they're vendor-prefixed because they're not standardized, so the CSSWG doesn't define how they act. This should be raised against the browser vendor to decide.

I can see arguments either way, fwiw:

  • On the pro side, this seems self-evidently useful.
  • On the con side, this exposes internal details of how the part is implemented. This is precisely why sub-parts have to be explicitly forwarded by the component for them to be visible in the outer page. (::before/etc are present on all elements, so it doesn't expose anything, beyond just whether or not the component is also using the pseudo.)
  • Back on the pro side, components can forward sub-parts into their own exposed parts, surfacing useful bits when needed. But there's no syntax for forwarding built-in pseudos, so forbidding it by default would also forbid it at all times.

Overall, I suspect the morally correct answer is to lean towards not exposing them, but I suspect the practically correct answer is to expose them.

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

No branches or pull requests

4 participants