Skip to content

fix(Theme): the page root follows the reader only through reset.css, so Core's stylesheet leaves a host's scheme alone - #12247

Merged
josephfarina merged 4 commits into
mainfrom
josephfarina/theme-root-scheme-reset-only
Nov 17, 2026
Merged

josephfarina merged 4 commits into
mainfrom
josephfarina/theme-root-scheme-reset-only

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Stack: #12247 → #12250, #12270

User impact

Since the fix that makes a system Theme take the page's scheme, Core's stylesheet (astryx.css, and the stylesheet a source build emits) also sets the page root to color-scheme: light dark when the root has no forced mode. An app that loads astryx.css without reset.css, and names no scheme of its own, now turns dark for a reader whose device is set to dark: the page canvas, native controls and any host text without its own color flip, while host elements with explicit colors keep them (a white card on a now-dark page). Installing Astryx must leave a host's own styles alone, and a light host page with an Astryx widget should stay light, widget included.

Problem and solution fit

  1. Why it occurs: astryx.css carries @layer reset { :where(html:not([data-theme])) { color-scheme: light dark; } }, the same rule reset.css has. An app that keeps its own preflight leaves out reset.css on purpose, but it still loads astryx.css, so the rule reaches its root.
  2. Why it harms the task: the host's page changes with the reader's device setting although the host never opted in.
  3. Why that matters: established apps adopt Astryx exactly this way (Core's stylesheet without reset.css), and the setup check's rule is that installing Astryx changes none of the host's own styles or color-mode behavior.

The root rule now lives only in reset.css, as before that fix. Core's stylesheet carries no reset block again. A system Theme still declares no scheme and takes the page's: with reset.css that is the reader's preference; under a host that sets the root's scheme, the host's; and on a root that names none, light, as the page draws. useTheme() resolves system the same way, so charts match the CSS: to the one scheme the root names, to light when it names none (normal), and to the reader's preference when it names both. An app without reset.css that wants to follow the device imports reset.css, or sets color-scheme: light dark on html. An artifact viewer that draws its frame dark sets the root's scheme itself, so a system Theme still turns dark there.

Expected behavior and authority

  • spec:AST-080 FR3, amended back in this PR: Core, Lab, Rich Text and Charts each export one stylesheet with every rule inside @layer astryx-base, besides Core's reset.css; none emits a reset block of its own.
  • component:Theme FR2, amended in this PR: the page root's scheme is light dark from reset.css, or one the host sets; with neither, the page is light. Its verification row names the without-reset.css case as staying light.
  • architecture:theme-application INV7, amended in this PR: useTheme() resolves system to the scheme the page draws in, the root's, else the page's color-scheme meta, else light, as the wrapper's CSS does.
  • architecture:theme-compilation INV18, amended in this PR: under a root mode other than light or dark, a color-mode block follows the reader's preference.
  • The maintainers decided this placement: the root rule belongs to reset.css only, so that Astryx content matches the page it sits in.

Smallest restoration

  • packages/build/src/source-stylesheet.js and scripts/build-css.mjs: Core's block no longer begins with a root block (the CORE_ROOT_BLOCK constant and the core option are gone).
  • packages/core/src/theme/useTheme.ts: a root that names no scheme resolves system to light; Theme.tsx and Theme.doc.mjs say that reset.css makes the root follow the reader.
  • Records: spec:AST-080 FR3, FR7, the ordering rule and its current-state line; component:Theme FR2 and its verification row; architecture:theme-application INV7 and its verification row.
  • The unreleased changeset of the earlier fix now says what a page that names no scheme sees and how an app without reset.css follows the device; it still names the build package, whose source build sets no root scheme.
  • useTheme() reads the page's <meta name="color-scheme"> when the root names no scheme, as browsers do, and its root observer watches that meta.
  • architecture:theme-compilation INV18 and the defineTheme docs say that under a system root a @dark block follows the reader's preference: that is the page's scheme whenever the page follows the reader, and on a page that names no scheme it still applies for a dark reader.

Evidence

  • Setup check, new canonical case in setup-canonical.test.ts: the plain Tailwind host, which names no scheme, loads astryx.css alone (no reset.css, no theme stylesheet) and adds an Astryx button. The root's computed color-scheme stays normal in the light and the dark reader runs, and the host shows no regression. With the root rule put back into astryx.css, the case fails (light dark instead of normal). The standard install and the guest-contained install still pass.
  • ThemeColorScheme.a11y.chromium.spec.ts (Chromium): the host's dark root still makes system Themes and useTheme() dark (the artifact-viewer case, kept), also when the host's scheme arrives in a linked stylesheet; reader light: all light; reader dark with reset.css: system Themes dark; reader dark without reset.css, on a root that names no scheme: the root is normal, system Themes light, and the system Theme under a forced light Theme follows the reader (dark); a root Theme that forces dark keeps the page dark.
  • useTheme.test.tsx: a root that names none resolves system to light; a color-scheme meta that names both lets the preference decide, one names that scheme; a root that names both, or an engine that reports no scheme, leaves the preference to decide.
  • ThemeColorScheme.a11y.chromium.spec.ts: without reset.css, a page whose color-scheme meta names both schemes is dark for a dark reader, in the CSS and in useTheme(); without it, useTheme() reports light as the CSS does.
  • build-css.layers.test.mjs and source-stylesheet.test.mjs: Core's stylesheet is the order line and one astryx-base block again; next.turbopack.test.mjs finds reset.css's chunk as before.

Scope

Components: Theme; Core's stylesheet (astryx.css and the source build)

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

R1 narration: none; the FR2, FR3 and INV7 sentences state what the stylesheets, Theme and useTheme() do.
R2 research: none in the records.
R3 evidence: the verification rows cite the tests that hold each case, not a change.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: none touched.
R7 project status: AST-080's current-state line states what the packages export, with no root block. INV18 states what a system root's blocks do now, with no plan in it.

Testing

  • pnpm exec vitest run --project ui packages/core/src/theme (1817 tests).
  • pnpm exec vitest run --project node scripts/build-css.layers.test.mjs packages/build/src/source-stylesheet.test.mjs.
  • ASTRYX_CANONICAL_SETUP_BROWSER=1 pnpm vitest run internal/vibe-tests/setup-test/setup-canonical.test.ts --project node --maxWorkers=1 (the new case, the standard s1 install and the guest-contained install; the new case also fails with the root rule restored to astryx.css).
  • pnpm storybook:build, then pnpm exec playwright test ThemeColorScheme (Chromium).
  • pnpm check:knowledge; core tsc; Prettier and ESLint on the changed files.

…Core's stylesheet leaves a host's scheme alone
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 17, 2026 9:36am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 17, 2026, 9:50 AM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): the root color-scheme rule comes out of astryx.css and the source build, and lives only in reset.css, as before. spec:AST-080 FR3 returns to its earlier wording, with Theme FR2 and theme-application INV7 amended to match: a system Theme still inherits the document's scheme, and useTheme() resolves system to light on a root that names no scheme. The reason is zero damage to host apps that load astryx.css without reset.css. A new canonical setup case covers that host: its root stays normal in both modes and the case fails if the rule returns. The changeset tells apps without reset.css how to follow the OS dark setting.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec f07213a

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 913798a

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: taking the root rule out of Core's stylesheet works as intended, but three problems need fixing first.

  • useTheme() returns light on a page that declares <meta name="color-scheme" content="light dark"> and loads no reset.css, although Chromium and Firefox draw that page and its system Themes dark for a dark reader, so charts and canvas paint light on dark (useTheme.ts:245-247); read the meta when the root computes normal, and add a Chromium case for it.
  • A theme's @dark component blocks still follow prefers-color-scheme, so on a page without reset.css a dark reader gets those dark overrides on a light page, which contradicts architecture:theme-compilation INV18 and the changeset's "never turns dark"; make those blocks follow the page's scheme, or amend INV18, the defineTheme docs and the changeset to match.
  • The description says the changeset drops @astryxdesign/build, but the head still names it on line 3, so please correct that bullet.

The amended AST-080, Theme and theme-application records are approved at this head, and no public API changes. The inline comments give the details, plus one non-blocking wording note.

Claims and files checked

Review mode: full; reason: no-earlier-review

Claims (description):

  • At the base, Core's stylesheet sets an unforced root to follow the reader: verified (base source-stylesheet.js root block; base capture shows the root computing light dark).
  • At the base, an app with Core's stylesheet but no reset turns dark for a dark reader: verified (base capture).
  • Core's stylesheet now carries no reset block: verified (head astryx.css built here; layer and source-build tests pass).
  • A system Theme takes the page's scheme: the reader's with the reset, the host's when set, light on a root that names none: verified for the CSS (head captures).
  • useTheme() matches the CSS in each case: false on a page that declares its schemes with a color-scheme meta element (Chromium and Firefox captures).
  • An app without the reset can follow the device by importing it or setting the root's scheme: verified (with-reset capture; reset rule).
  • A host that sets the root dark still gets dark system Themes: verified (unchanged unit test for a root that names only dark).
  • The three records are amended as described: verified (head text).
  • The build constant and the core option are gone: verified (diff; tests pass).
  • The changeset drops the build package: false (the changeset still names it on line 3).
  • The new setup case keeps the root normal in both modes: consistent with the test code; not run here.
  • The Chromium cases behave as listed: the dark-reader cases with and without the reset are reproduced in this review's captures; the unchanged cases were not run.
  • The theme unit tests and the build tests pass: verified (58 and 16 passed).
  • No new public API: verified (API generator, no rows).
  • No internal context in public text: verified.

Claims (changeset):

  • A system Theme takes the surrounding page's scheme, so a dark host gets dark inside: verified (unit tests).
  • useTheme() and useSyntaxTheme() resolve system to the root's scheme, light when it names none, else the device: false for a meta-declared page.
  • Under a forced Theme a system Theme follows the device: verified (capture).
  • A scheme the app sets on the root decides: verified (unit tests).
  • useSyntaxTheme() follows a forced Theme: verified (it reads useTheme().mode).
  • The reset makes the root follow the device: verified (reset rule; capture).
  • Without the reset and with no root scheme, the page stays light and an Astryx widget never turns dark: false for a theme with dark color-mode blocks (fixture capture).
  • Core's stylesheet sets no scheme on the root: verified.

Files:

  • .changeset/theme-system-follows-host-scheme.md: findings 2 and 3.
  • docs/architecture/theme-application.md: finding 1 (the new "the page then draws light" reading).
  • docs/specs/AST-080-package-stylesheets/spec.md: non-blocking wording note.
  • docs/specs/components/theme/Theme.spec.md: clear.
  • internal/vibe-tests/setup-test/setup-canonical.test.ts: clear.
  • packages/build/src/next.turbopack.test.mjs: clear.
  • packages/build/src/source-stylesheet.js: clear.
  • packages/build/src/source-stylesheet.test.mjs: clear.
  • packages/core/src/theme/Theme.doc.mjs: clear.
  • packages/core/src/theme/Theme.tsx: clear.
  • packages/core/src/theme/__tests__/ThemeColorScheme.a11y.chromium.spec.ts: finding 1 (no meta case, no hook-mode check without the reset).
  • packages/core/src/theme/useTheme.test.tsx: clear.
  • packages/core/src/theme/useTheme.ts: finding 1; stale comment note.
  • scripts/build-css.layers.test.mjs: clear.
  • scripts/build-css.mjs: clear.

Automated review (maintainer link)

Comment thread packages/core/src/theme/useTheme.ts Resolved

- Core, Lab, Rich Text, and Charts export one stylesheet each with every rule
inside `@layer astryx-base`, besides Core's FR3 root block in `reset`. Non-Core stylesheets omit the Core variable
- Core, Lab, Rich Text, and Charts already export one stylesheet each with every

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: "already export" is temporary project status in a Current-state impact line. "Core, Lab, Rich Text, and Charts export one stylesheet each …" says the same in the present tense.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 871dac2

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
lab/DialogHeroHeader 89.4 kB (+162 B) · 372 B CSS (0) — — · — · —
Markdown 203.8 kB (+147 B) · 22.0 kB CSS (0) — — · — · —
lab/Comments 371.2 kB (+147 B) · 2.5 kB CSS (0) — — · — · —
119 more components
Component Size LoC Visual · A11y · RTL
lab/ListInput 94.3 kB (+146 B) · 922 B CSS (0) — — · — · —
Lightbox 146.7 kB (+143 B) · 12.0 kB CSS (0) — — · — · —
Toast 104.4 kB (+143 B) · 11.1 kB CSS (0) — — · — · —
lab/CommentThread 364.3 kB (+143 B) · 2.4 kB CSS (0) — — · — · —
Overlay 23.6 kB (+139 B) · 3.9 kB CSS (0) — — · — · —
charts/Chart 239.0 kB (+128 B) · 516 B CSS (0) — — · — · —
richtext/RichTextEditorToolbar 300.1 kB (+6 B) · 454 B CSS (0) — — · — · —
lab/ChatReactionBar 115.0 kB (+5 B) · 1.1 kB CSS (0) — — · — · —
lab/CommentComposer 174.2 kB (+5 B) · 1.9 kB CSS (0) — — · — · —
richtext/RichTextView 282.7 kB (+5 B) · 2.3 kB CSS (0) — — · — · —
Carousel 74.9 kB (+3 B) · 11.7 kB CSS (0) — — · — · —
MultiSelector 101.9 kB (+3 B) · 17.8 kB CSS (0) — — · — · —
BreadcrumbItem 97.1 kB (+2 B) · 13.3 kB CSS (0) — — · — · —
DropdownMenuCheckboxItem 28.6 kB (+2 B) · 7.3 kB CSS (0) — — · — · —
FileInput 74.3 kB (+2 B) · 11.7 kB CSS (0) — — · — · —
MoreMenu 107.9 kB (+2 B) · 18.9 kB CSS (0) — — · — · —
SideNavCollapseButton 66.1 kB (+2 B) · 10.8 kB CSS (0) — — · — · —
SideNavHeading 82.8 kB (+2 B) · 12.1 kB CSS (0) — — · — · —
Table 120.4 kB (+2 B) · 19.7 kB CSS (0) — — · — · —
TopNavHeading 82.3 kB (+2 B) · 12.0 kB CSS (0) — — · — · —
TopNavMegaMenu 76.3 kB (+2 B) · 12.7 kB CSS (0) — — · — · —
Typeahead 88.1 kB (+2 B) · 13.5 kB CSS (0) — — · — · —
lab/ChatEmojiPicker 113.9 kB (+2 B) · 773 B CSS (0) — — · — · —
lab/Schedule 114.9 kB (+2 B) · 3.9 kB CSS (0) — — · — · —
Button 65.2 kB (+1 B) · 10.8 kB CSS (0) — — · — · —
ButtonGroup 44.1 kB (+1 B) · 3.7 kB CSS (0) — — · — · —
ChatComposerTokenElement 82.5 kB (+1 B) · 12.1 kB CSS (0) — — · — · —
ChatDictationButton 65.8 kB (+1 B) · 10.9 kB CSS (0) — — · — · —
ChatSendButton 65.6 kB (+1 B) · 10.8 kB CSS (0) — — · — · —
ContextMenuItem 35.5 kB (+1 B) · 7.1 kB CSS (0) — — · — · —
DateInput 200.3 kB (+1 B) · 18.0 kB CSS (0) — — · — · —
DropdownMenu 107.7 kB (+1 B) · 18.9 kB CSS (0) — — · — · —
MobileNavToggle 65.5 kB (+1 B) · 10.8 kB CSS (0) — — · — · —
Selector 113.4 kB (+1 B) · 18.7 kB CSS (0) — — · — · —
SelectorOption 24.1 kB (+1 B) · 6.7 kB CSS (0) — — · — · —
SideNav 121.4 kB (+1 B) · 12.2 kB CSS (0) — — · — · —
TextArea 67.0 kB (+1 B) · 9.4 kB CSS (0) — — · — · —
Thumbnail 69.6 kB (+1 B) · 12.4 kB CSS (0) — — · — · —
Timestamp 27.0 kB (+1 B) · 11.1 kB CSS (0) — — · — · —
ToggleButton 92.3 kB (+1 B) · 10.9 kB CSS (0) — — · — · —
Tokenizer 104.5 kB (+1 B) · 20.4 kB CSS (0) — — · — · —
lab/EmojiPicker 92.7 kB (+1 B) · 751 B CSS (0) — — · — · —
lab/TransferList 112.4 kB (+1 B) · 1.2 kB CSS (0) — — · — · —
lab/TransferListSelector 121.3 kB (+1 B) · 1.4 kB CSS (0) — — · — · —
AppShell 97.9 kB (0) · 14.4 kB CSS (0) — — · — · —
Banner 67.2 kB (0) · 11.3 kB CSS (0) — — · — · —
Calendar 76.3 kB (0) · 11.4 kB CSS (0) — — · — · —
ChatComposerInput 82.5 kB (0) · 12.1 kB CSS (0) — — · — · —
ChatLayoutScrollButton 65.8 kB (0) · 11.0 kB CSS (0) — — · — · —
ChatToolCalls 31.8 kB (0) · 8.5 kB CSS (0) — — · — · —
CheckboxList 73.3 kB (0) · 7.8 kB CSS (0) — — · — · —
CheckIndicator 8.5 kB (0) · 681 B CSS (0) — — · — · —
CodeBlock 80.7 kB (0) · 12.2 kB CSS (0) — — · — · —
CommandPalette 78.1 kB (0) · 12.8 kB CSS (0) — — · — · —
CommandPaletteInput 33.1 kB (0) · 7.6 kB CSS (0) — — · — · —
ComplexSelector 77.9 kB (0) · 12.7 kB CSS (0) — — · — · —
DateRangeInput 99.5 kB (0) · 13.3 kB CSS (0) — — · — · —
DateTimeInput 223.8 kB (0) · 19.8 kB CSS (0) — — · — · —
DrawerHeader 68.3 kB (0) · 13.8 kB CSS (0) — — · — · —
DropdownMenuItem 27.8 kB (0) · 6.9 kB CSS (0) — — · — · —
DropdownMenuRadioItem 28.7 kB (0) · 7.3 kB CSS (0) — — · — · —
FieldLabel 55.6 kB (0) · 5.8 kB CSS (0) — — · — · —
FieldStatus 10.1 kB (0) · 3.6 kB CSS (0) — — · — · —
Icon 8.3 kB (0) · 681 B CSS (0) — — · — · —
IconButton 65.2 kB (0) · 10.8 kB CSS (0) — — · — · —
InfoTip 50.6 kB (0) · 5.4 kB CSS (0) — — · — · —
ListItem 79.3 kB (0) · 12.1 kB CSS (0) — — · — · —
NumberInput 77.7 kB (0) · 12.2 kB CSS (0) — — · — · —
Popover 98.9 kB (0) · 15.2 kB CSS (0) — — · — · —
PowerSearch 307.3 kB (0) · 25.6 kB CSS (0) — — · — · —
RadioList 61.0 kB (0) · 7.4 kB CSS (0) — — · — · —
RadioListItem 76.3 kB (0) · 10.7 kB CSS (0) — — · — · —
SegmentedControl 102.3 kB (0) · 6.9 kB CSS (0) — — · — · —
SideNavItem 77.2 kB (0) · 11.9 kB CSS (0) — — · — · —
Slider 114.7 kB (0) · 8.9 kB CSS (0) — — · — · —
Step 31.6 kB (0) · 5.6 kB CSS (0) — — · — · —
Stepper 66.9 kB (0) · 10.9 kB CSS (0) — — · — · —
Switch 109.1 kB (0) · 10.0 kB CSS (0) — — · — · —
TabList 47.5 kB (0) · 6.5 kB CSS (0) — — · — · —
TabMenu 79.1 kB (0) · 11.9 kB CSS (0) — — · — · —
TextInput 72.9 kB (0) · 12.0 kB CSS (0) — — · — · —
ToggleButtonGroup 41.4 kB (0) · 3.7 kB CSS (0) — — · — · —
Token 29.6 kB (0) · 4.9 kB CSS (0) — — · — · —
TopNav 78.2 kB (0) · 11.8 kB CSS (0) — — · — · —
TreeList 46.2 kB (0) · 5.9 kB CSS (0) — — · — · —
lab/CommentPin 60.5 kB (0) · 1.2 kB CSS (0) — — · — · —
lab/NavigationScreen 85.0 kB (0) · 1.5 kB CSS (0) — — · — · —
lab/NavigationStack 85.0 kB (0) · 1.5 kB CSS (0) — — · — · —
lab/TabBar 83.6 kB (0) · 1.8 kB CSS (0) — — · — · —
lab/TabBarItem 3.9 kB (0) · 1.8 kB CSS (0) — — · — · —
lab/TabBarMoreList 102.1 kB (0) · 1.8 kB CSS (0) — — · — · —
richtext/RichTextEditor 306.1 kB (0) · 2.6 kB CSS (0) — — · — · —
BaseTypeahead 78.6 kB (−1 B) · 11.7 kB CSS (0) — — · — · —
ChatComposer 84.8 kB (−1 B) · 12.9 kB CSS (0) — — · — · —
ChatLayout 88.5 kB (−1 B) · 11.4 kB CSS (0) — — · — · —
CheckboxInput 69.2 kB (−1 B) · 10.2 kB CSS (0) — — · — · —
CheckboxListItem 80.1 kB (−1 B) · 12.1 kB CSS (0) — — · — · —
Collapsible 29.0 kB (−1 B) · 4.5 kB CSS (0) — — · — · —
ContextMenu 102.2 kB (−1 B) · 18.8 kB CSS (0) — — · — · —
DialogHeader 68.1 kB (−1 B) · 12.4 kB CSS (0) — — · — · —
InputGroup 61.2 kB (−1 B) · 7.9 kB CSS (0) — — · — · —
Pagination 124.3 kB (−1 B) · 19.1 kB CSS (0) — — · — · —
ProgressBar 12.0 kB (−1 B) · 6.4 kB CSS (0) — — · — · —
TableSelectionToolbar 75.5 kB (−1 B) · 14.1 kB CSS (0) — — · — · —
TimeInput 175.1 kB (−1 B) · 17.0 kB CSS (0) — — · — · —
lab/DiffViewer 93.4 kB (−1 B) · 2.1 kB CSS (0) — — · — · —
lab/SelectableCardGroup 69.0 kB (−1 B) · 162 B CSS (0) — — · — · —
DropdownMenuSubMenu 78.7 kB (−2 B) · 10.5 kB CSS (0) — — · — · —
Field 59.6 kB (−2 B) · 7.3 kB CSS (0) — — · — · —
MobileNav 76.5 kB (−2 B) · 11.4 kB CSS (0) — — · — · —
TableCell 103.5 kB (−2 B) · 19.2 kB CSS (0) — — · — · —
AlertDialog 128.9 kB (−3 B) · 15.5 kB CSS (0) — — · — · —
lab/PageControl 78.2 kB (−3 B) · 709 B CSS (0) — — · — · —
Citation 20.8 kB (−4 B) · 4.4 kB CSS (0) — — · — · —
Link 56.5 kB (−4 B) · 7.1 kB CSS (0) — — · — · —
lab/TourStep 93.5 kB (−4 B) · 691 B CSS (0) — — · — · —
ChatMessageMetadata 20.5 kB (−5 B) · 4.1 kB CSS (0) — — · — · —
TableHeaderCell 103.1 kB (−5 B) · 19.0 kB CSS (0) — — · — · —
TopNavMenu 81.8 kB (−6 B) · 12.0 kB CSS (0) — — · — · —

Package size:

  • @astryxdesign/build 34.5 kB packed (−359 B); no new dependencies
  • @astryxdesign/core 7.63 MB packed (+1.1 kB); no new dependencies

Wide change (shared styles: packages/core/src/theme/Theme.tsx, packages/core/src/theme/defineTheme.ts, packages/core/src/theme/useTheme.ts): add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

…em root's @dark blocks are documented as following the reader
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 9c6a532

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the record amendments are approved at this head and the earlier meta, @dark and description findings are resolved, but one new problem fails CI.

  • The two new poll callbacks in packages/core/src/theme/__tests__/ThemeColorScheme.a11y.chromium.spec.ts (lines 231 and 257) return a promise without being async, so the Lint check fails with two @typescript-eslint/promise-function-async errors; write .poll(async () => hookModes(page)) as lines 149 and 163 already do.

Two non-blocking notes: useTheme() still differs from Chromium for an empty color-scheme meta placed before a valid one and for a meta added outside <head> after load, and the useTheme.ts file header and the useTheme JSDoc still describe the old fallback to the system preference. No public API changes.

Claims and files checked

Review mode: full; reason: spec-record

Claims (description):

  • At the base, Core's stylesheet sets a root with no forced mode to follow the reader: verified (the base's built stylesheet begins with that rule).
  • At the base, an app that loads Core's stylesheet without the reset turns dark for a dark reader: verified (base capture, root computes light dark).
  • The root rule now lives only in the reset, and Core's stylesheet has no reset block: verified (head stylesheet built here; layer and source-build tests pass).
  • A system Theme takes the page's scheme: the reader's with the reset, the host's when it sets one, light when the root names none: verified (head captures; unit tests).
  • useTheme() resolves system the same way, to light on a root that names no scheme and to the preference when it names both: verified (unit tests; captures).
  • useTheme() reads the page's color-scheme meta when the root names none, as browsers do: verified for a meta in the head that names one or both schemes; differs for an empty meta placed first and for a meta added outside the head (non-blocking).
  • An app without the reset can follow the device by importing it or setting the root's scheme: verified (capture with the reset).
  • A host that sets the root dark still gets dark system Themes and a dark useTheme(): verified (unchanged unit test for a root that names only dark).
  • The four records are amended as described: verified (head text).
  • The build constant and the core option are gone: verified (diff; build tests pass).
  • The changeset still names the build package: verified (line 3).
  • The new setup case keeps the root normal in both modes and fails with the rule restored: consistent with the test code; not run here.
  • The Chromium cases behave as listed: the dark-reader cases with and without the reset, and with a meta, reproduced in this review's captures; the other cases are unchanged and were not run.
  • The useTheme unit cases behave as listed: verified (pass on the head; the two new cases fail on the base).
  • The theme unit tests, build tests and knowledge check pass: verified (1818, 16 and the knowledge check pass here).
  • ESLint passes on the changed files: false in CI's strict mode (two errors, lines 231 and 257 of the Chromium spec).
  • No new public API: verified (API comparison, no rows).
  • No internal context in public text: verified.

Claims (changeset):

  • A system Theme takes the scheme of the page around it, so a dark host gets dark inside: verified (unit tests).
  • useTheme() and useSyntaxTheme() resolve system to the scheme the root names, light when it names none, else the device: verified, with the meta read the changeset states at its end.
  • Under a forced Theme a system Theme follows the device: verified (capture).
  • A scheme the app sets on the root decides: verified (unit tests).
  • The reset makes the root follow the device, and Core's stylesheet sets no root scheme: verified.
  • Without the reset and with no declared scheme the page, tokens and useTheme() stay light, while a theme's own @dark styles still follow the device: verified (fixture capture).
  • To follow the device, import the reset or set the root's scheme: verified.
  • useTheme() reads the page's color-scheme meta as the browser does: verified with the two edge cases above.

Files:

  • .changeset/theme-system-follows-host-scheme.md: clear.
  • docs/architecture/theme-application.md: clear.
  • docs/architecture/theme-compilation.md: clear.
  • docs/specs/AST-080-package-stylesheets/spec.md: non-blocking wording note (line 246).
  • docs/specs/components/theme/Theme.spec.md: clear.
  • internal/vibe-tests/setup-test/setup-canonical.test.ts: clear (not run).
  • packages/build/src/next.turbopack.test.mjs: clear.
  • packages/build/src/source-stylesheet.js: clear.
  • packages/build/src/source-stylesheet.test.mjs: clear.
  • packages/core/src/theme/Theme.doc.mjs: clear.
  • packages/core/src/theme/Theme.tsx: clear.
  • packages/core/src/theme/__tests__/ThemeColorScheme.a11y.chromium.spec.ts: blocking Lint finding.
  • packages/core/src/theme/defineTheme.ts: clear.
  • packages/core/src/theme/useTheme.test.tsx: clear.
  • packages/core/src/theme/useTheme.ts: non-blocking meta edge cases and stale comments.
  • scripts/build-css.layers.test.mjs: clear.
  • scripts/build-css.mjs: clear.

Automated review (maintainer link)

Comment thread packages/core/src/theme/useTheme.ts Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 871dac2

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: the CI run on this head stopped before its build and test jobs because CI was full, so it needs a re-run before merge.

The change does what it says: without reset.css the page root stays normal, and system Themes and useTheme() stay light for a reader who prefers dark. The earlier Lint failure on the two poll callbacks is fixed.

Non-blocking:

  • useTheme() still differs from Chromium for a color-scheme meta that names only an unknown scheme (Chromium stops there and draws light; useTheme() reads a later dark meta) and for a meta added outside <head> after load.
  • The comment at useTheme.ts:221-223 and the "already export" line in the package stylesheet record's Current-state impact still use the old wording.
Claims and files checked

Review mode: incremental; reason: none

changed rules (0): none

Claims:

  • The changeset: a system Theme takes the scheme of the page around it, so a host's dark page makes it dark (verified: Theme.tsx:386-393 declares no scheme for a root system Theme; Chromium host-root case in the spec).
  • The changeset: useTheme() and useSyntaxTheme() report the same mode (verified: SyntaxTheme.tsx:99-101 reads useTheme().mode).
  • The changeset: a system Theme resolves to the root's one scheme, light when it names none, else the device's setting, and follows the device under a forced Theme (verified: useTheme.ts:264-286; Chromium captures).
  • The changeset: an app that sets the root's scheme decides what a system Theme shows (verified: useTheme.ts:271-273).
  • The changeset: reset.css makes the root follow the device, and Core's stylesheet, prebuilt or source-built, sets no root scheme (verified: reset.css:91; source-stylesheet.js:412-421; build tests 16/16).
  • The changeset: without reset.css and a declared scheme the page, tokens and useTheme() stay light while a theme's @dark styles still follow the device (verified: Chromium captures; theme compiler unchanged).
  • The changeset: to follow the device, import reset.css or set color-scheme: light dark on html (verified: the root rule in reset.css; a root or meta naming both schemes draws dark for a dark reader).
  • The changeset: useTheme() reads the page's color-scheme meta as the browser does (verified, apart from two rare meta shapes noted above).
  • The changeset still names the build package (verified: changeset line 3).
  • Core's stylesheet carried the root rule before this change, so a host without reset.css turned dark for a dark reader (verified: base source-stylesheet.js:424-438; base capture computes light dark).
  • The root rule now lives only in reset.css; the constant and the core option are gone (verified: head build sources; packages/build returns exactly to its state before the earlier change).
  • useTheme() resolves system to the root's one scheme, else the meta, else light, and reads the meta through its observer (verified: useTheme.ts:264-286, :294-314, :339-367).
  • The package stylesheet, Theme, theme-application and theme-compilation records are amended as described (verified: the diff of the four records).
  • Theme's comments and docs, and the defineTheme docs, say what reset.css and a system root do (verified: Theme.tsx:283-284, :382-386; Theme.doc.mjs:78, :120; defineTheme.ts:193-198).
  • The new setup case keeps the root normal in both modes without reset.css (read, not run: setup-canonical.test.ts:183-195, :243-248).
  • The Chromium spec covers the host root, a linked host stylesheet, both readers with and without reset.css, a meta naming both schemes and a forced dark root (verified: spec lines 136-264; the no-reset, reset and meta cases reproduced in Chromium).
  • The useTheme and build tests cover the cases listed (verified: useTheme.test.tsx:394-442; UI suite 1,819 passed; build tests 16/16).
  • No new public API (verified: API generator, 0 rows in every published package).
  • No internal context in public text (verified: residue scan of the diff, commits, title and body).
  • Testing: the core/theme UI run has 1,817 tests (stale: 1,819 at this head, non-blocking).
  • Lint and typecheck pass (verified: strict ESLint 0 errors on the changed files; Core's declaration build succeeds; CI Lint green).

Files:

  • .changeset/theme-system-follows-host-scheme.md: clear.
  • docs/architecture/theme-application.md: clear.
  • docs/architecture/theme-compilation.md: clear.
  • docs/specs/AST-080-package-stylesheets/spec.md: non-blocking wording note (line 246).
  • docs/specs/components/theme/Theme.spec.md: clear.
  • internal/vibe-tests/setup-test/setup-canonical.test.ts: clear (not run).
  • packages/build/src/next.turbopack.test.mjs: clear (not run).
  • packages/build/src/source-stylesheet.js: clear.
  • packages/build/src/source-stylesheet.test.mjs: clear.
  • packages/core/src/theme/Theme.doc.mjs: clear.
  • packages/core/src/theme/Theme.tsx: clear.
  • packages/core/src/theme/__tests__/ThemeColorScheme.a11y.chromium.spec.ts: clear (Lint fixed).
  • packages/core/src/theme/defineTheme.ts: clear.
  • packages/core/src/theme/useTheme.test.tsx: clear.
  • packages/core/src/theme/useTheme.ts: non-blocking meta edge cases and one stale comment.
  • scripts/build-css.layers.test.mjs: clear.
  • scripts/build-css.mjs: clear.

Automated review (maintainer link)

Comment on lines +275 to +284
for (const meta of document.querySelectorAll(SCHEME_META)) {
const content = meta.getAttribute('content') ?? '';
const fromMeta = oneScheme(content);
if (fromMeta !== undefined) {
return fromMeta;
}
if (/(^|\s)normal(\s|$)/i.test(content)) {
return 'light';
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: HTML takes the first color-scheme meta whose content is a valid color-scheme value, and a lone unknown name such as content="foo" is valid. With that meta before one that says dark, Chromium stops at the first and draws the page and its system Themes light, while this loop skips it and useTheme() reports dark. Stopping at the first meta whose content parses as a color-scheme value (normal alone, or names with an optional only), and resolving it to light when it names neither scheme, matches the browser.

@josephfarina josephfarina reopened this Nov 17, 2026
@josephfarina josephfarina reopened this Nov 17, 2026
@josephfarina
josephfarina merged commit e8c6cc0 into main Nov 17, 2026
288 of 309 checks passed
@github-actions
github-actions Bot deleted the josephfarina/theme-root-scheme-reset-only branch November 18, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — 871dac2b Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant