Re: [csswg-drafts] [css-scoping] Allow elements to expose a subset of their shadow tree, which can then be styled with regular CSS (#10939)

@michaelwarren1106 I do agree that this could lead to brittle selectors, though in many cases there is very obviously a single element type that can be targeted. E.g. for the spinner example above, it is highly unlikely you’d want to change the `<input>` or `<button>`s to something else.

A big pain point with parts that this was designed to solve was the burden of defining names for the component author and learning names for the component consumer, which balloons for complex use cases (e.g. think of styling an entire date picker popup). A solution with less cognitive overhead could be in line with the tree subsetting idea, by introducing higher granularity around what is exported (which I mentioned in the OP as a Level 2 feature): being able to hide certain attributes from the exported subtree or even the element type (simply by defining that no type selector can ever match it). It is an open question what should the default behavior be.

@sorvell I suspect that doing this in CSS makes it much harder to implement, (currently) impossible to monitor changes to by authors, and introduces the potential for cycles (we can design the feature in such a way that it avoids cycles, but it’s an additional design consideration). It is also unclear what the benefit is: CSS is good for applying things to elements in aggregate, but here you typically only have one instance of each element to deal with, so this seems like it introduces friction and indirection without much benefit.

-- 
GitHub Notification of comment by LeaVerou
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10939#issuecomment-2378173395 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 27 September 2024 00:25:45 UTC