[csswg-drafts] [css-shadow-parts] consider putting more power on user instead of author

lifaon74 has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-shadow-parts] consider putting more power on user instead of author ==
The current spec is centered around the lib (custom element) author, but doesn't really thing about the users (developers which use the custom element) and its limitations. If the author of a custom element doesn't include **_part_** attributes the element won't be able to be themed even in legit situations (like a font size or a color, from a charts lib).
This get even worse for nested custom elements from different authors... (like an **input** from author A which use a **datepicker** from author B). In real situation the custom element nesting may be often greater than 10. One missing **_part_** attribute could be dramatic.
Moreover, in enterprise, we deal a lot with legacy or 'closed' code. We could be forced to theme an unmaintened custom element without **part** (some libs are maintained 'only' 1 year... where legacy code could last 10 years, sad reality of the vast majority of companies...) or to theme a 'closed' code (like a paying charts lib, where pull requests are impossible).

**All of this shows us that the power should be in the hands of the user (here the developer) instead of the author.** Users represent far more people than authors (a custom element developed by one guy could be used by millions).

>From the specs:
> The previous proposed method for styling inside the shadow tree, the >>> combinator, turned out to be too powerful for its own good; it exposed too much of a component’s internal structure to scrutiny, defeating some of the encapsulation benefits that using Shadow DOM brings.

I found it pretty damn wrong. Developers are grown people ! They have and **want** powerful tools and are perfectly able to use them safely. We could all postfix css rules with `!important` but we won't do it because we all know it should be used with caution. The reality shows us that as some point we strongly need power.

**All of this to say** : what about re-introducing the /deep/ operator ? Or a least some equivalent from the css shadow parts that allow user (the user of the lib (custom element)) to force deep shadow piecing for some critical situations were no other choice is possible. For me the current css shadow parts is too much centered around the author which have final decision to put **part**, where the real need is for users.

Feel free to comment and to propose solutions, the discussion is open.

PS: to be absolutely clear, here the term 'user' represent the developers which use custom elements (shadow element) from other developers (called 'authors').

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2963 using your GitHub account

Received on Monday, 30 July 2018 07:32:49 UTC