Re: [w3ctag/design-reviews] Declarative CSS Modules and Declarative Shadow DOM `adoptedstylesheets` attribute (Issue #1000)

KurtCattiSchmidt left a comment (w3ctag/design-reviews#1000)

> That's very reasonable. I think it would be valuable to add a small section to the explainer about this.

Good idea, I will update the explainer.
 
> It seems like this would have a shadowroot visibility issue.

Anything in the DOM will have DOM scoping though. If a developer needs non-DOM scoping, they can use the module map (including declarative modules).

> Not sure what you mean here. It's just (currently) limited to CSSStyleSheet. While css modules produce these, you can also just construct one in JS.

The current spec for `shadowrootadoptedstylesheets` retrieves the module script the same way script retrieves a module script. I would prefer to keep this consistency vs introducing something new specifically for when the attribute references a non-constructed stylesheet. That way, if we added `import "./index.html#foo;` in script imports, `shadowrootadoptedstylesheets` would pick that up automatically. Script has other options in this case (e.g. `document.getElementById("foo").sheet` or a constructable stylesheet), but this seems like a good case for consistency.
 
> Though not directly relevant to elements and modules, this issue does suggest the ability to tie specifiers to urls, which might be worth some thought and/or an explainer mention: [whatwg/html#12163](https://github.com/whatwg/html/issues/12163)

Interesting, I will take a look.

> Yeah, `@import` rules work in Firefox with the setting. This makes sense since the sheet isn't constructed. If [@import](https://github.com/import) were added to constructed sheets/modules as I hope it can be, this would no longer be a reason to prefer using non-constructed sheets, but I do think there are still other reasons to support non-constructed sheets.

From my understanding, the `@import` limitation on constructable stylesheets was never meant to be permanent. Can you elaborate on the other reasons to support non-constructed sheets? 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/1000#issuecomment-3953929933
You are receiving this because you are subscribed to this thread.

Message ID: <w3ctag/design-reviews/issues/1000/3953929933@github.com>

Received on Tuesday, 24 February 2026 18:28:16 UTC