Re: [WICG/webcomponents] "open-stylable" Shadow Roots (#909)

> > I am hoping that the implementation blocker to https://github.com/WICG/webcomponents/issues/909#issuecomment-742851382 doesn't apply to layers, after all user-agent styles are already layer-like allowed in.
> 
> Sorry... I don't understand how these are related? Can you explain?

@bkardell I am hoping that _priority_ and _specificity_ are not related in a way that would block implementation to inheriting outer style layers into shadow trees.

To elaborate:

This issue was opened in 2020 for the [primary use case](https://github.com/WICG/webcomponents/issues/909#issuecomment-1889740959) of component library maintainers who want to move to web components while supporting stylesheets that they don't control.

This issue was originally framed in terms of shadow-boundary-crossing selectors and by necessary implication specificity, since that was the main/only approach at that time.

WebKit reviewer @rniwa immediately pointed out that [evaluating a selector across shadow boundaries](https://github.com/WICG/webcomponents/issues/909#issuecomment-742851382) would involve an unwanted architecture-level change.

But the core CSS cascade itself has been broadening with new priority-based steps beyond just evaluating selector specificity.

Since this issue was opened in 2020, a couple of things have happened:

- Observations of many along the lines that "[[n]ew combinators probably will not suffice](https://github.com/WICG/webcomponents/issues/909#issuecomment-1889740959)", and "[y]ou typically want select page styles to trickle in, but [you don’t typically want to pull in entire stylesheets](https://github.com/WICG/webcomponents/issues/909#issuecomment-1936910846)".

- Cascade layers landed in browsers in [2022](https://caniuse.com/css-cascade-layers), and made priority by order of appearance, similar to origin priority, available to author styles.

But shadow trees have their own cascade step, as of the [2020 draft](https://www.w3.org/TR/2020/WD-css-cascade-4-20200818/#cascade-sort) the context step articulates the priority between inner and outer context for shadow-specific selectors. The context step evaluates winners also in a way similar to origin priority.

So my reasoning is that:

- Browser-specific architectures did not block quick implementation of layers
- Shadow trees can have layers inside them too, they just don't know (yet) about outer context layers
- Shadow trees already necessarily allow shadow-crossing origins with user-agent styles
- The cascade context step already does limited-purpose priority sorting

So on the whole I am hoping that access to outer style layers inside shadow trees (and reordering them as desired inside the shadow tree) will not hit similar implementation blocks. 



-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/909#issuecomment-1973774453
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/909/1973774453@github.com>

Received on Friday, 1 March 2024 19:15:51 UTC