MicrosoftEdge / MicrosoftEdge/MSEdgeExplainers

[Declarative Shadow DOM Style Sharing] Proposal should be renamed and background and problem rephrased

Open
#1,191 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

DeclarativeShadowDOMStyleSharing
Dominant language
HTML
Stars
1.4k
Forks
286
Avg merge
3d 1h
Merged PRs (30d)
8

Description

I think that the title and framing of this proposal are causing a lot of confusion among reviewers. The current background and problem statement make it sound like this proposal is starting from the position of finding a way to share styles among shadow roots, and reviewers seem to take that as a cue to look at the entire problem and solution space of sharing styles, causing them to broaden the scope to other issues or try to invent new ways of sharing styles.

As I mentioned in my original proposal in https://github.com/WICG/webcomponents/issues/939, the core problem is:

Declarative shadow roots and constructible stylesheets need to be made to work together so that stylesheets added to shadow roots can be round-tripped through HTML serialization and deserialization.

I would suggest these main points for background:

  • The most common way, by far, of styling web components today is with adoptedStyleSheets which allow sharing styles across multiple shadow roots
  • adoptedStyleSheets are not representable in HTML

This leads to workarounds for SSR:

  • Convert adoptedStyleSheets to <style> tags during SSR. This causes duplication and breaks the adoptedStyleSheets semantics
  • Convert adoptedStyleSheets to some non-style representation (ie <script>) and use JavaScript to adopt the styles. This doesn't work with JS disabled and may cause FOUC.

Style duplication, FOUC, and requiring JS are just problems with the available workarounds though. The core problem at hand is still that adoptedStyleSheets are not serializable nor compatible with declarative shadow DOM.

When the proposal leads with duplication as the problem, it sounds like good solutions may include novel ways of sharing styles. But a novel style sharing solution that doesn't support serializing adoptedStyleSheets would still leave us in a place where we need this proposal in order to support adoptedStyleSheets. In other words, we already have style sharing, we just need to make representable in HTML.

So I would rename the proposal to something like "Declarative adoptedStyleSheets" and focus the background and problem statement on the lack of serializability.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the proposal discussed in this issue and compare its title, background, and problem statement with the framing described here. Rename it to reflect declarative adoptedStyleSheets and center the problem on serializing adoptedStyleSheets for declarative shadow DOM. Done means the revised framing no longer presents novel style sharing as the core problem.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
documentation, web-dev
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.