Repository navigation
Description
Summary
#264 fixed the two headers explaining the CSS scoping pass. Grepping the rest of the tree for the
same retired premise — that the sheet is appended to the host document's <head> — turns up five
more sites, plus one claim that needs a decision rather than a rewording.
The pattern is the one #264 described: the stated reason is gone, the conclusion is usually
still right, and a maintainer who checks the reason and finds it false could reasonably delete the
code it defends.
Found incidentally while implementing #264.
Approach
Comments only, in five files. The ground truth is src/styles/sheet.ts and
scripts/assert-css-scoped.mjs, which are both already correct.
The mechanism is simply stale — rewrite the clause, keep the conclusion
src/styles/fonts.ts:18
The stylesheet is injected as a string into the host's
<head>
(vite-plugin-css-injected-by-js), and a CSS url() resolves against the DOCUMENT's base URL
The conclusion survives and is the whole point of the file: a relative url() in a constructed
stylesheet still resolves against the document base URL, not against our chunk. Only the
"injected into the host's <head>" clause is wrong. Note sheet.ts:21-24 says @font-face is
deliberately not in the adopted sheet and that fonts.ts really does put its own tag in
document.head — so this file is the one place the old mechanism partly still applies. Say which
half is which.
docs/architecture.md:102
CSS is injected by JS (
vite-plugin-css-injected-by-js), so the widget styles itself when
embedded.
Imprecise rather than false. The plugin is still in the chain, but with an injectCodeFunction
that parks chunks on globalThis for src/styles/sheet.ts instead of appending a <style>.
The reason is gone and the code may not need defending any more
src/components/molecules/List/List.tsx:50 and its spec List.test.tsx:7
The widget's CSS injects into HOST documents, where a host typography rule on bare
ulorli,
such asli { list-style: disc }, beats preflight's inherited reset and paints bullets next to
every card.
A host's li selector cannot match our <li> inside the shadow root at all, so the stated
failure is unreachable for the embed. Decide whether the explicit list-none/m-0/p-0 resets
still earn their place — an inherited list-style-type set on an ancestor of <sahaj-atlas> does
still cross the boundary, which may be a narrower but real reason to keep them — then write
whichever answer is true. List.test.tsx asserts those classes, so its rationale moves with the
decision.
src/styles/base.css:31
This stylesheet is injected into the HOST document, and Swiper is a popular library, so
.swiperroots routinely exist on host pages: theming that selector reaches straight into their
carousels.
Same shape. Keying on .sy-carousel is still the right call for the standalone shell and Ladle,
but the host-carousel hazard it is justified by is gone for the embed.
Needs a decision, not a rewrite
The keyframe-namespacing rationale says a bare @keyframes fadeIn "would hijack any host
animation of that name". It appears three times: scripts/postcss-scope-widget.mjs (the
namespaceKeyframes region), src/styles/globals.css:563, and verbatim in
scripts/assert-css-scoped.mjs. Keyframe names in a sheet adopted into a shadow root are
tree-scoped, so for the embed there is no host collision left to prevent, and the standalone shell
has no host. The namespacing is still required — the shell, Ladle, and the gate that enforces it —
so the work is re-deriving the reason once and writing the same wording to all three, rather
than three divergent rewrites.
scripts/assert-css-scoped.mjs is in scope here even though #264 treated it as the reference: it
is correct about the scoping pass and carries this one stale claim.
Acceptance criteria
- No comment in
src/,scripts/ordocs/claims the built stylesheet is appended or
injected into the host document's<head>, except where it is true of
src/styles/fonts.ts's own<style>tag. -
src/styles/fonts.ts's header distinguishes its owndocument.headtag, which is real,
from the adopted sheet, which is not appended anywhere. -
List.tsx,List.test.tsxandbase.csseach state a reason that is true post-fix(ui): host CSS without !important still restyles widget text #236, or
the code they defend is removed with the reason. - The keyframe-collision rationale reads the same in all three files and is true of the embed.
- Every
⚠line,#NNNbreadcrumb and tool directive in the touched files survives.
Verification checklist
-
grep -rn "injected into the HOST\|HOST document's <head>\|into the host's <head>" src/ scripts/ docs/
returns only thefonts.tscase, correctly qualified. -
comment-fingerprint.mjs --base mainreports the code hash identical, unless theList
decision removes code — then say so in the PR body. -
pnpm buildpasses, includingassert:css. -
pnpm lint && pnpm typecheck && pnpm test:runpass.
Notes
Unrelated staleness noticed in the same file, worth folding in while there:
scripts/postcss-scope-widget.mjs:65 says :host appears in "Tailwind 3.4's Preflight", and
package.json pins tailwindcss at 4.3.3.
Related, same root cause: #236 is the change that retired the premise, and
#261, #262, #263 and
#264 are the four tickets filed for it so far. This is the fifth, and it is
the in-code comment surface none of them covered.
🤖 Written by the sydevs autonomous loop — see what this is
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
sydevs-bot commentedon Oct 10, 2026
Two more sites for this sweep, found reviewing #269.
src/AGENTS.md:17— "The stylesheet lands in a host page, and a host that setshtml { font-size: 62.5% }rescales everyrem". #269 corrects the twin of this sentence inglobals.css's@themeblock. None of this ticket's grep terms match "lands in a host page", so it escaped the census. It loads in every session that touchessrc/.The weaker half names a protection the pass cannot give.
assert-css-scoped.mjs:8-15says an unscoped selector in the boundary-less builds "repaints the page around it", implying the pass stops it. The scope class sits ondocument.documentElementthere (index.html:9,.ladle/components.tsx:35), so:where(.sy-atlas) :is(main)matches whatmainmatched. The prefix confines nothing. What the pass does there is collapse the root selectors and namespace the keyframes. Same three files as the keyframe item, so re-derive both in one pass.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code