Skip to content

docs(comments): the CSS scoping pass still says the widget has no shadow boundary #264

Closed

Description

@sydevs-bot

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-js appends 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 #91 breadcrumb survives, and a #236 breadcrumb records the change in mechanism.
  • Every ⚠ line in both files survives.
  • No non-comment line changes in either file.

Verification checklist

  • git diff shows 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 build passes, including assert:css.
  • pnpm lint && pnpm typecheck && pnpm test:run pass.

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

Activity

  1. added theissue type on Oct 9, 2026
  2. added
    proposal
    on Oct 9, 2026
  3. Ardnived commented on Oct 10, 2026

    @Ardnived
    Contributor

    @sydevs-bot implement

  4. added
    bot:working
    and removed
    proposal
    on Oct 10, 2026
  5. sydevs-bot commented on Oct 10, 2026

    @sydevs-bot
    ContributorAuthor

    🤖 no session running

    recent dispatches
    • 17:11Z implement · attempt 1 · session · done
    • 17:11Z implement · attempt 1 · session

    Written by the sydevs dispatcher. Sessions never edit this comment.

  6. removed
    bot:working
    on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    Low

    Hold Until

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions