Repository navigation
Description
Summary
The two headers that explain why the build-time CSS scoping pass exists both state a premise
#236 retired: that the widget has no shadow boundary and that its stylesheet is appended to the
host document's <head>. Neither is true. The pass is still load-bearing, for a different
reason — so a maintainer who checks the premise and finds it false could reasonably conclude the
pass is obsolete and delete it.
Found incidentally while fixing the troubleshooting row in #261.
Approach
Two files, comments only. No behaviour changes.
scripts/postcss-scope-widget.mjs:7-9:
WHY (issue #91): the widget has no shadow boundary.
vite-plugin-css-injected-by-jsappends our whole stylesheet to the
HOST document's<head>, after the host's own sheets, so it wins style ties.
src/styles/globals.css:3-6:
This stylesheet is injected into the HOST page's , so a top-level selector
restyles somebody else's site.
What actually ships now (src/styles/sheet.ts:62-89): the sheet is a constructed
CSSStyleSheet assigned to adoptedStyleSheets. src/main.tsx:15-17 records the change in
passing and is the only comment in the tree that has it right — "The embed's sheet is adopted by
its shadow root, so the build stopped appending a <style> to document.head altogether."
The pass is still required, and the new rationale is the one to write. main.tsx adopts the
same sink into document for the standalone shell, where <html> is the theme root — so an
unscoped selector there still hits the whole document. The pass also collapses the root selectors
(:root, html, body, :host) onto .sy-atlas, which is what gives the widget a root of its
own inside the shadow root, and it namespaces keyframes. scripts/assert-css-scoped.mjs is the
gate either way.
Keep the #91 breadcrumb and every ⚠ line (docs/rules/code-comments.md), and add the #236
breadcrumb for the change. Compress rather than clear-cut — the headers carry measurements and
hazards worth keeping, including the two leaks that motivated making the invariant mechanical.
Acceptance criteria
- Neither header claims the widget has no shadow boundary, nor that the stylesheet is appended
to the host document's<head>. - Both headers state why the pass is still required, naming the standalone shell's
document-wide adoption as the reason. - The
#91breadcrumb survives, and a#236breadcrumb records the change in mechanism. - Every
⚠line in both files survives. - No non-comment line changes in either file.
Verification checklist
-
git diffshows comment lines only. -
grep -rn "no shadow" scripts/ src/returns nothing claiming it of the widget.
src/main.tsx's "This shell has no shadow root" is correct and stays. -
pnpm buildpasses, includingassert:css. -
pnpm lint && pnpm typecheck && pnpm test:runpass.
Notes
docs/rules/mapbox.md:314 also says "nests no shadow root of its own" — that is about
@mapbox/search-js-web, is correct, and is not part of this.
Related, same root cause: #261 (the troubleshooting row that denied the
shadow root), #262 (a code defect in host-reset.css), and
#263 (the CSP style-src consequences). All four are #236's unswept blast
radius.
🤖 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
Ardnived commentedon Oct 10, 2026
@sydevs-bot implement
sydevs-bot commentedon Oct 10, 2026
🤖 no session running
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.