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

Investigate using :has-slotted when it's available in all browsers #2579

Open
jattasNI opened this issue Apr 3, 2025 · 0 comments
Open

Investigate using :has-slotted when it's available in all browsers #2579

jattasNI opened this issue Apr 3, 2025 · 0 comments
Labels
blocked Blocked on a third-party issue tech debt

Comments

@jattasNI
Copy link
Contributor

jattasNI commented Apr 3, 2025

🧹 Tech Debt

We have some places where we apply styles based on whether a slot contains content. Our current pattern for doing this involves using the FAST slotted directive to run JS code that tracks content being added and removed, then set classes on the component based on that state.

The native :has-slotted CSS pseudoclass is meant to provide the same capability using pure CSS. It's not currently available in Safari but once it is we should investigate whether we can use it instead to simplify our code and reduce execution overhead.

A non-exhaustive list of places that do this:

Lots more context on this CSSWG issue, including a tangent about why :has isn't appropriate since it doesn't operate across the shadow root boundary: w3c/csswg-drafts#6867

@jattasNI jattasNI added tech debt triage New issue that needs to be reviewed labels Apr 3, 2025
@m-akinc m-akinc added blocked Blocked on a third-party issue and removed triage New issue that needs to be reviewed labels Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked on a third-party issue tech debt
Projects
Status: Backlog
Development

No branches or pull requests

2 participants