Skip to content

fix(core): a theme's entry for a part on another component's element wins over that component's entries - #12378

Closed
josephfarina wants to merge 32 commits into
mainfrom
theme-part-wins-over-component
Closed

josephfarina wants to merge 32 commits into
mainfrom
theme-part-wins-over-component

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Stack: #12378 → #12450

User impact

Some theme targets sit on the element of another component they render, beside that component's own target: toggle-button, input-clear-button and calendar-nav on Button's element, clickable-card on Card's, the field and dialog close icons on Icon's. A theme that styles both gets whichever selector is more specific, so a button entry keyed on variant or size beats the theme's own entry for the part on the same element. A theme author who writes "the toggle button's border is red" sees nothing happen wherever the theme also styles that Button variant, and has no way to make the part's entry hold.

Problem and solution fit

  1. Why does it happen? Both entries compile into the same astryx-theme layer, so the cascade decides by specificity, then source order. A keyed button rule (.astryx-button[data-variant="secondary"]) outranks a plain .astryx-toggle-button rule.
  2. Why does that hurt? The part's entry is the more precise statement of what the theme wants on that element, yet it is the one that loses, and which one wins changes with unrelated keys elsewhere in the theme.
  3. Why does that matter? Targets on shared elements are how a theme reaches a component's own pieces (a toggle button, a clear button) without restyling every Button. If the part's entry can't hold, the target can't do its job.

The fix gives the part's entry a cascade layer of its own. When a theme has an entry for such a part, the compiler writes the theme's rules in two astryx-theme sub-layers, @layer components, parts;, with the part's rules in parts. Layer order beats specificity, so the part's entry wins over the theme's entries for the component it sits on, and nothing else moves.

Expected behavior and authority

architecture:theme-compilation gains INV22 (a part on another component's element wins over that component's entries), INV4 now names the sub-layers, and the verification table has an INV22 row. Each such target names the target it sits on as sitsOn in its component doc (46 today, including Pagination's pagination-item, the toast and banner close buttons on Button, and Lab's transfer-list-item on list-item and media-captions-button on toggle-button), and SHARED_ELEMENT_PARTS in the compiler holds the same list; a test keeps the two equal.

Smallest restoration

  • generateThemeRules.ts: component lowering takes a group option (parts or regular), and the layered outputs lower each group apart. Root, adaptation and media-surface order holds inside each sub-layer, and the color-scheme rules stay outside both.
  • A theme with no entry for these parts writes exactly the CSS it wrote before: no sub-layer at all.
  • The parts' rules follow a flipped surface's dark-page side exactly as the components' rules do (INV21): root and adaptation color-mode blocks, and every on-media rule, dark-page copies included.
  • Pagination's cells (pagination-item) sit on Button, so a theme's cell entries (a border between cells, the hover, the current page's fill) now win over its keyed button entries; component:Pagination FR20 and DEC-4 change from that limit to the cells' entries winning (a behavior change in the record, not formatting; the table is also reflowed the way Prettier writes it).
  • Timestamp's and Timer's targets sit on Text's element but stay out of the list and in components: Core's overrides for Text's color and size props decide there by weight and order beside the theme's text entries, so Timestamp and Timer draw exactly as on main.
  • astryx theme build and family builds write the same sub-layers, reading the layer statement from the project's Core. A build with an older Core, which returns no part rules, keeps the single layer.
  • Additions it needs, each recorded in INV22: the sitsOn field on component doc targets; {layered: true} on generateThemeRulesSplit, generateAdaptationCSS and generateOnMediaCSS, which then return the parts' rules apart (ThemeRulesSplit.parts; generateOnMediaCSS returns {component, parts}); and the exported THEME_SUB_LAYER_ORDER. These are public because the CLI builds with the project's own Core, which it reaches only through public exports. Without the option every function returns what it did before. No component, prop, token or default changes.
  • Stage order (INV12, amended): root, adaptation, media-surface order holds inside each sub-layer, and a part's entries beat its component's at every stage, so a part's root entry beats the component's onDark/onLight and adaptation entries on the same element.

Evidence

  • Reproduction before the change: a theme with button: {'variant:ghost': {borderColor: 'transparent'}} and 'toggle-button': {base: {borderColor: 'red'}} compiles both into one layer, where the keyed button rule wins on a ghost toggle button.
  • Result after the change: the toggle-button rule sits in @layer parts, after @layer components, so it wins.
  • Representative unchanged path: a theme with no part entries compiles byte for byte as before. Built with the CLI against main and against this branch, neutral, stone, matcha and chocolate are byte-identical. Butter, gothic and y2k move their clickable-card, selectable-card, app-shell-sidenav, dropdown-menu-radio, selector-popup and multi-selector-popup rules into parts (butter also its chat-send-button corner, which no button rule sets), and their computed styles don't change: those rules already came after (and outranked) the card, layout-panel and popover rules they share elements with or set the same values, none of the three writes radio-indicator, and none writes those hosts on a media surface or in an adaptation.
  • Regression test: sharedElementParts.test.ts fails without the change (the part's rule is not in a later sub-layer).

Official-theme sweep

Every official theme, plus the probe theme, built with astryx theme build against main and against this branch:

Theme Built CSS Computed styles
neutral, stone, matcha, chocolate byte-identical unchanged
butter, gothic, y2k clickable-card, selectable-card, app-shell-sidenav, dropdown-menu-radio, selector-popup and multi-selector-popup rules move into @layer parts unchanged
probe every part's rules move into @layer parts parts now win over the component they sit on (the probe theme exists to exercise every target)

Why butter, gothic and y2k draw the same: apart from butter's send-button corner, their moved rules set only --color-text-primary, --color-text-secondary and --color-text-accent, none of the three writes radio-indicator, and their popover rule sets the same three values as their selector popups' rules. Before/after full-page screenshots of a page with an open dropdown menu of radio items and an open selector are pixel-identical for all three themes in light and dark. On the elements they share, the theme's card rules for the same variants already came earlier at the same specificity, and its layout-panel rule has lower specificity than the app-shell-sidenav one, so the part's rules already won; none of the three writes card or layout-panel on a media surface or in an adaptation. Only conflicts between a part and the component it sits on can change, and in the published themes there are none the part was losing.

Records changed

  • architecture:theme-compilation: INV22 (new; main took INV20 and INV21), INV4 names the sub-layers, INV12 amended (order holds inside each sub-layer; a part's entries beat its component's at every stage), and verification rows for INV12 and INV22 (build.packed-old-core.test.mjs proves the older-Core single layer).
  • component:Pagination: FR20 and DEC-4 state that the cells' entries win over button entries whatever their keys (INV22). The FR table is also reflowed by Prettier.
  • 37 Core component docs (AlertDialog, AppShell, Banner, Calendar, Chat, CheckboxInput, CheckboxList, ClickableCard, CodeBlock, ComplexSelector, DateInput, DateRangeInput, DateTimeInput, Dialog, Drawer, DropdownMenu, Field, FieldStatus, FileInput, List, Markdown, MoreMenu, MultiSelector, Pagination, RadioList, SelectableCard, Selector, Switch, Timestamp, Toast, ToggleButton, Typeahead and their sub-component docs) and Lab's TransferList and MediaPlayer docs: 46 theming targets gain sitsOn.

Writing rubric results

R1 narration: none; INV22 and FR20/DEC-4 describe what the compiler and Pagination do, in the present tense.
R2 research: none; the official-theme sweep and screenshots live in this description, not the records.
R3 evidence: the INV22 row names test suites and the facts they prove (one layer on an older Core, the sub-layers on a current one), no pull request or commit.
R4 rejected alternatives: none recorded.
R5 change references: none in either record.
R6 open questions: none added.
R7 project status: none.

Scope

Components: theme compiler (@astryxdesign/core/theme), CLI theme build, the theming targets in 37 Core component docs and Lab's TransferList and MediaPlayer docs (46 targets gain sitsOn), Pagination's record

  • 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: the additions are listed above (sitsOn, the {layered: true} outputs, THEME_SUB_LAYER_ORDER and the ThemeLayerOptions type).
  • Public text and artifacts contain no internal Meta context.

Testing

  • sharedElementParts.test.ts: doc sitsOn entries equal SHARED_ELEMENT_PARTS, each naming an existing target; a part's entry lands in parts and its component's in components; a theme with no part entry has no sub-layer; root, adaptation and media-surface order holds inside parts; a flipped surface's dark-page side is followed in parts; a theme's timestamp and timer entries stay in components with a listed part present; an !important value in a button entry stays in components and a part's in parts.
  • partPrecedence.a11y.chromium.spec.ts with the Core/Themes/PartPrecedence story (Chromium; the existing accessibility-spec leg selects it by its file pattern, no workflow change): a toggle-button entry, which turns the sub-layers on, changes nothing a plain Text, a Timestamp or a Timer draws, under text entries (none, a base entry, type-keyed and one-key color:/size: entries) × timestamp/timer entries (absent, at the root, in an adaptation, on a dark media surface) × caller props (none, color, size, color="secondary"). Its colors clear 4.5:1 on their backgrounds.
  • build.packed-old-core.test.mjs: a packed CLI keeps one layer for a part's entry on a core whose split returns no parts, and writes the sub-layers on a current one.
  • build.shared-element-parts.test.mjs: a CLI single build and a family build write the same sub-layers, color-scheme rules outside them; a theme with no part entry keeps one layer.
  • The Core theme suites, themingTargets, the CLI theme build suites (including the packed older Core) and check:knowledge, check-cli-structure, ESLint, Prettier and core tsc pass.

Owner approval

An engineering owner approves the record changes at this head with /approve-spec <full head SHA>. They are architecture:theme-compilation INV22, INV4, INV12 and the INV12 and INV22 verification rows, and component:Pagination FR20 and DEC-4. INV22 changed after the last approval: Timestamp and Timer stay beside Text, and an !important value in the component's entry beats one in the part's.

Review notes

  • The last review's two Timestamp and Timer findings (a colour- or size-keyed timestamp/timer entry not painting under a caller's prop, and keyed text entries from another stage not following the part) are resolved by scope: timestamp and timer are no longer in SHARED_ELEMENT_PARTS, so they stay in components beside Text and draw exactly as on main. The precedence spec covers both cases (one-key color:/size: entries; entries at the root, in an adaptation and on a dark surface). Giving those parts' entries precedence over Text's prop overrides needs a decision on component:Timestamp AV2, so it is a separate follow-up.
  • The JSDoc sentence-length notes applied to the Text prop-override helpers, which this head no longer has.
  • !important: CSS reverses layer order for important declarations, so when both entries mark a value important, the component's entry still wins. INV22, INV12 and the changeset say so, and sharedElementParts.test.ts pins where both values land.
  • Lab's transfer-list-item sits on ListItem's element and media-captions-button on ToggleButton's, beside listed parts. They are listed too, so they share parts with the part they sit on: their order against it stays as on main, and they still beat item and button. The parity test reads Lab's docs as well as Core's.
  • Follow-ups (each behaves as on main today): six Lab MediaPlayer targets on Button's element (media-play-button, media-seek-button, media-volume-button, media-fullscreen-button, media-track-button, media-playback-rate-button) are not listed yet; generateOnMediaCSS could take options?: ThemeLayerOptions like its siblings; theme-compilation's applies_to could name sharedElementParts.ts and family.mjs.
  • The precedence spec has no @pr-a11y scope line yet, so a change that touches only Text, Timestamp or Timer does not run it. Adding one is a follow-up.
  • The theme-compilation.md INV22 row now separates its suites, verified_by names the Chromium spec, and the row describes what the spec renders.

@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 21, 2026 3:51am 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 21, 2026, 2:20 PM 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): when a part sits on a component that delegates to it, the part's own theme entry wins over that component's through a later astryx-theme sub-layer, which the target declares in its doc entry, not through selector specificity. architecture:theme-compilation records the rule; tests cover it; and a sweep of every official theme shows that only conflicts between a part and the component it sits on change.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 8d52bd5

@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.

Needs an owner decision, then changes. The approved architecture:theme-compilation INV20 covers letting a part's theme entry beat the component it sits on, but the new public Core signatures have no deciding record, and four fixes are needed either way.

Approval needs an engineering owner to decide THEME_SUB_LAYER_ORDER, the layered options parameter on generateThemeRulesSplit and generateAdaptationCSS, the new generateOnMediaCSS overload, the group parameter on generateThemeRules and ThemeRulesSplit.parts: record them in architecture:theme-compilation and approve that head with /approve-spec <full head SHA> (the author may, as an engineering owner), or keep them internal to Core.

  • docsite-build fails because THEMING_TARGET_FIELDS in apps/docsite/scripts/lib/theming-doc.mjs lacks the sitsOn field that generate-data.mjs now emits, so add 'sitsOn' there.
  • dropdown-menu-item, dropdown-menu-indicator-icon and timestamp-copy-button sit on Item, Icon and Button just as selector-option, selector-indicator-icon and code-block-copy-button do, so give them sitsOn and add them to SHARED_ELEMENT_PARTS; until then the changeset's claim is false for DropdownMenu and Timestamp.
  • INV12 still says media-surface overrides emit last, yet a part's root entry now beats its host's onDark, onLight and adaptation entries (a ToggleButton on a dark surface no longer takes the theme's onDark button border), so amend INV12 and its verification row or keep stage order across the sub-layers.
  • The description names sitsOn and THEME_SUB_LAYER_ORDER as the only additions, so list the other new Core signatures above or remove them.
Claims and files checked

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

  • Claim: a part's theme entry now wins over the host's entries whatever their selectors (changeset): false for three parts missing from the list (DropdownMenu item and submenu icon, Timestamp copy button); verified for the 32 listed (core and CLI tests, browser frames).
  • Claim: a toggle-button entry now beats a button entry keyed on variant (changeset, description): verified (compiled CSS and browser frames).
  • Claim: the runtime and the CLI write the same two sub-layers, the part's rules last (changeset): verified (CLI single-build and family-build test).
  • Claim: each such target names its host as sitsOn and the compiler's list matches (changeset, description): the two lists match (test), but three such targets are missing from both.
  • Claim: a theme with no part entry keeps its CSS byte for byte (changeset, description): verified (core test; four published themes build identical CSS).
  • Claim: the published themes' looks do not change (changeset, description): verified (three themes only move rules that already outranked their hosts; the rest are identical).
  • Claim: root, adaptation and media-surface order holds inside each sub-layer, colour-scheme rules outside (description): verified (core and CLI tests).
  • Claim: the fix moves nothing else (description): false; a part's root entry now also beats its host's adaptation and media-surface entries (browser frames).
  • Claim: a CLI build with an older core keeps one layer (description): verified (build code checks for the returned parts; older-core build test passes).
  • Claim: the only additions are sitsOn and THEME_SUB_LAYER_ORDER (description): false; the head also changes four generate* signatures and adds ThemeRulesSplit.parts.
  • Claim: the new core test fails without the change (description): verified (it imports a module the base lacks).
  • Claim: the core theme suites, theming-target tests and CLI theme build suites pass (description): verified locally; the docsite projection test, not claimed, fails.
  • Claim: no internal context in public text (description): verified.
  • File .changeset/theme-part-wins-over-component-it-sits-on.md: finding (claim false for three parts).
  • File apps/docsite/scripts/generate-data.mjs: finding (projection field list not updated; docsite-build red).
  • File docs/architecture/theme-compilation.md: finding (INV12 left contradicting INV20; non-blocking wording in INV20's last sentence).
  • File packages/cli/api/theme/build/build.mjs: clear.
  • File packages/cli/api/theme/build/build.shared-element-parts.test.mjs: clear.
  • File packages/cli/api/theme/build/family.mjs: clear.
  • File packages/cli/authoring/doctypes/base/type.ts: clear.
  • Files, 30 component docs (AlertDialog, AppShell, Banner, Calendar, Chat, CheckboxInput, CheckboxList, ClickableCard, CodeBlock, ComplexSelector, DateInput, DateRangeInput, DateTimeInput, Dialog, DialogHeader, Drawer, DrawerHeader, Field, FieldStatus, FileInput, List, Markdown, MultiSelector, RadioList, SelectableCard, Selector, Switch, Timer, Timestamp, ToggleButton): clear; each sitsOn names the component whose element the target renders on.
  • File packages/core/src/theme/defineTheme.ts: clear (new export awaits owner decision).
  • File packages/core/src/theme/generateThemeRules.ts: new public signatures await owner decision; non-blocking comment suggestions.
  • File packages/core/src/theme/index.ts: clear (new export awaits owner decision).
  • File packages/core/src/theme/sharedElementParts.test.ts: finding (compares the two lists only, so it cannot catch a part missing from both).
  • File packages/core/src/theme/sharedElementParts.ts: finding (three parts missing).

Automated review (maintainer link)

Comment thread apps/docsite/scripts/generate-data.mjs Resolved
Comment thread docs/architecture/theme-compilation.md Resolved
Comment thread docs/architecture/theme-compilation.md Resolved
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 1ad0fd4

⏳ Building… Until it's ready, Storybook · Sandbox open the branch's previous preview.

Current run: The current CI run concluded cancelled. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

… icon and the timestamp copy button; record the public layered outputs and the stage order with parts; docsite reads sitsOn
@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 update (engineering owner, covering this pull request at its current head): architecture:theme-compilation INV12 now says stage order holds inside each sub-layer and a part's entries beat its component's at every stage, including a part's root entry over its component's onDark entry. INV20 names the CLI-facing build exports the CLI compiles through (THEME_SUB_LAYER_ORDER, the layered split and adaptation options, ThemeRulesSplit.parts, and the layered generateOnMediaCSS overload), served from the same @astryxdesign/core/theme entry as generateThemeRulesSplit and listed in the public theme-helper contract test.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 310d850

@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: three parts are missing from the shared-element list. The sub-layer fix has its record (architecture:theme-compilation INV12 and INV20 are approved for this head), and the four points from the earlier review are fixed.

  • Miss: dropdown-menu-divider (on Divider), dropdown-menu-radio (on the radio indicator) and selector-check (on Icon, through the check indicator) sit on another component's element like the listed parts but have no sitsOn and no SHARED_ELEMENT_PARTS entry, so a theme's entry for them still loses to a keyed divider, radio-indicator or icon entry; add sitsOn to their doc targets and the three entries to the list.

The INV20 wording about a core with no SHARED_ELEMENT_PARTS and two comments in generateThemeRules.ts are non-blocking (see the inline comments). CI's build and test jobs did not run on this head because CI was full, so they still need to run with the fix.

Claims and files checked

Review mode: full; reason: spec-record

  • Claim (changeset): a part's entry on another component's element now wins whatever the selectors. False for dropdown-menu-divider, dropdown-menu-radio and selector-check; verified for the 35 listed parts (tests, Chromium fixture).
  • Claim (changeset): a toggle-button entry beats a button entry keyed on variant or size. Verified (Chromium fixture, sharedElementParts.test.ts).
  • Claim (changeset): such a theme writes two sub-layers with the part's rules last, and <Theme> and astryx theme build write the same CSS. Verified (build.shared-element-parts.test.mjs).
  • Claim (changeset): each such target names its host as sitsOn. False for the same three parts.
  • Claim (changeset): a theme with no part entry keeps its CSS byte for byte, and the published themes look the same. Built CSS verified (neutral, stone, matcha, chocolate identical; butter, gothic, y2k move only three targets' rules); looks not rendered.
  • Claim (description): the doc sitsOn entries and the compiler list are equal, kept by a test. Verified (test passes, 35 entries).
  • Claim (description): a build with an older Core keeps one layer. Verified (packed older-Core build test).
  • Claim (description): the public additions are listed, and without the option each function returns what it did. Verified (API surface compare of base and head).
  • Claim (description): stage order holds inside each sub-layer and a part's root entry beats its host's surface entry. Verified (sharedElementParts.test.ts).
  • Claim (description): the regression test fails without the change. Verified by construction (it imports a module the base lacks); not run on the base.
  • Claim (description): the knowledge check, ESLint, Prettier and core tsc pass. Knowledge check and lint verified; tsc not re-run, and CI's typecheck did not run.
  • Files with a finding: packages/core/src/theme/sharedElementParts.ts, packages/core/src/DropdownMenu/DropdownMenu.doc.mjs, packages/core/src/Selector/Selector.doc.mjs, .changeset/theme-part-wins-over-component-it-sits-on.md (missing parts); docs/architecture/theme-compilation.md and packages/core/src/theme/generateThemeRules.ts (non-blocking wording and comments).
  • Files clear: packages/cli/api/theme/build/build.mjs, packages/cli/api/theme/build/family.mjs, packages/cli/api/theme/build/build.shared-element-parts.test.mjs, packages/cli/authoring/doctypes/base/type.ts, apps/docsite/scripts/generate-data.mjs, apps/docsite/scripts/lib/theming-doc.mjs, packages/core/src/theme/defineTheme.ts, packages/core/src/theme/index.ts, packages/core/src/theme/publicThemeHelperContract.test.ts, packages/core/src/theme/sharedElementParts.test.ts, and the sitsOn edits in the AlertDialog, AppShell, Banner, Calendar, Chat, CheckboxInput, CheckboxList, ClickableCard, CodeBlock, ComplexSelector, DateInput, DateRangeInput, DateTimeInput, Dialog, DialogHeader, Drawer, DrawerHeader, DropdownMenuCheckboxItem, DropdownMenuItem, Field, FieldStatus, FileInput, List, Markdown, MultiSelector, RadioList, SelectableCard, Switch, Timer, Timestamp and ToggleButton docs.

Automated review (maintainer link)

…check are shared-element parts; record wording
@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 7af32c9

@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

Look check for the three themes whose built CSS changes here (butter, gothic, y2k), on a page with a card, a text field, a checkbox, buttons and an open dropdown menu holding checked and unchecked radio items, at desktop and phone widths, light and dark:

  • Before (main) and after (this branch) full-page screenshots are pixel-identical for all three themes in both modes, and the menu radio's computed color, background and border are the same.
  • The look check reports the same findings before and after, none on the menu radio: the primary button's hover and pressed states look like rest (all three themes), and in butter the open menu's trigger button takes a flat gray fill. Both are on main already and are tracked separately.

What moves is only each theme's text-color rule for the menu radio, into the later sub-layer; none of the three themes styles the radio indicator itself, so the same rule wins on that element.

@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: CI has not finished on this head yet. The three parts the last review found missing (dropdown-menu-divider, dropdown-menu-radio and selector-check) are now in SHARED_ELEMENT_PARTS and carry sitsOn. Their theme entries now win over the keyed divider, radio-indicator and icon entries in the browser. The record changes (INV4, INV12 and INV20 of architecture:theme-compilation) are approved for this head.

Two optional cleanups: the comment at generateThemeRules.ts:2352 repeats the JSDoc above it (see the inline comment), and the description's Evidence bullet leaves out dropdown-menu-radio, which also moves into parts for butter, gothic and y2k.

Claims and files checked

Review mode: full; reason: spec-record

  • Claim (changeset): a part's entry on another component's element now wins over that component's entries whatever their selectors. Verified (Core and CLI tests; in Chromium toggle-button, dropdown-menu-divider, dropdown-menu-radio and selector-check take their own entry; a sweep of every theme-target call in Core finds no unlisted part).
  • Claim (changeset): a toggle-button entry beats a button entry keyed on variant or size. Verified (Chromium, sharedElementParts.test.ts).
  • Claim (changeset): such a theme writes two sub-layers with the part's rules last, and <Theme> and astryx theme build write the same. Verified (build.shared-element-parts.test.mjs).
  • Claim (changeset): each such target names its host as sitsOn. Verified (list test, 38 entries).
  • Claim (changeset): a theme with no part entry keeps its CSS byte for byte, and the published themes look the same. Built CSS verified (neutral, stone, matcha, chocolate identical; butter, gothic, y2k move four targets' rules, same rules, and no host rule outranked a moved one); looks not rendered.
  • Claim (description): 38 doc sitsOn entries equal the compiler's list, kept by a test. Verified.
  • Claim (description): a build with an older Core keeps one layer. Verified (packed older-Core build test).
  • Claim (description): the public additions are listed, and without the option each function returns what it did. Verified (API surface compare of base and head).
  • Claim (description): stage order holds inside each sub-layer, and a part's root entry beats its host's surface entry. Verified (sharedElementParts.test.ts).
  • Claim (description): butter, gothic and y2k draw the same. Verified from the built CSS; the Evidence bullet omits dropdown-menu-radio, which the sweep table lists.
  • Claim (description): the regression test fails without the change. Verified by construction (it imports a module the base lacks); not run on the base.
  • Claim (description): the theme suites, knowledge check, ESLint and core tsc pass. Verified (12 test files, knowledge check, ESLint on the changed files, Core and CLI typecheck).
  • Files with a note: packages/core/src/theme/generateThemeRules.ts (repeated comment).
  • Files clear: .changeset/theme-part-wins-over-component-it-sits-on.md, apps/docsite/scripts/generate-data.mjs, apps/docsite/scripts/lib/theming-doc.mjs, docs/architecture/theme-compilation.md, packages/cli/api/theme/build/build.mjs, packages/cli/api/theme/build/build.shared-element-parts.test.mjs, packages/cli/api/theme/build/family.mjs, packages/cli/authoring/doctypes/base/type.ts, packages/core/src/theme/defineTheme.ts, packages/core/src/theme/index.ts, packages/core/src/theme/publicThemeHelperContract.test.ts, packages/core/src/theme/sharedElementParts.test.ts, packages/core/src/theme/sharedElementParts.ts, and the sitsOn edits in the AlertDialog, AppShell, Banner, Calendar, Chat, CheckboxInput, CheckboxList, ClickableCard, CodeBlock, ComplexSelector, DateInput, DateRangeInput, DateTimeInput, Dialog, DialogHeader, Drawer, DrawerHeader, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuDivider, DropdownMenuItem, Field, FieldStatus, FileInput, List, Markdown, MultiSelector, RadioList, SelectableCard, Selector, Switch, Timer, Timestamp and ToggleButton docs.

Automated review (maintainer link)

@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: two Timestamp and Timer theme cases now draw the wrong colour. The sub-layer fix works and its record changes are approved for this head, but the Text overrides copied onto timestamp and timer need two fixes:

  • Miss: a colour-keyed timestamp or timer entry such as timestamp: {'color:accent': {color: 'red'}} never paints on a Timestamp with that color, because the copied Text override follows it at the same weight (generateThemeRules.ts:1224-1231), which contradicts component:Timestamp AV2, so skip the copy for a colour or size the part's own entries key on, or amend AV2.
  • A caller's color or size on a Timestamp or Timer loses the theme's keyed text entry when that entry and the part's entry sit at different stages (root, an adaptation, onDark or onLight), because the keyed copies come only from the same stage (generateThemeRules.ts:1219, :1237-1259), against INV22's "draws as it would with no part entry", so copy the keyed entries of every stage that applies and add those cases to the PartPrecedence story.

Non-blocking notes are inline. The description's Stack line does not hold yet: #12450 is still built on the previous head, so this pull request was reviewed on its own.

Claims and files checked

Review mode: full; reason: spec-record

  • Claim: Before the change, a keyed button entry beat the toggle-button entry on a ghost toggle button (verified: base compile writes both in one layer).
  • Claim: After the change, the toggle-button rule sits in a later parts sub-layer and wins (verified: head compile and unit test).
  • Claim: A theme with no part entry compiles byte for byte as before (verified: unit test and CLI build test).
  • Claim: Four official themes build identically, and three move only their part rules with no visible change (not rechecked on this head; the author's sweep).
  • Claim: The new regression test fails without the change (verified by reading: the module it imports does not exist on the base).
  • Claim: Forty-six targets in thirty-eight doc files name the target they sit on, and the compiler's list matches them (verified: count and unit test).
  • Claim: A part's rules follow a flipped surface's dark-page side (verified: unit tests).
  • Claim: Pagination cell entries win over button entries whatever their keys (verified: unit test).
  • Claim: For Timestamp and Timer, a prop the caller sets draws as it would with no part entry (false: fails for colour-keyed part entries and for entries at different stages).
  • Claim: A plain Text draws the same with or without the part entries (verified: unit test and compile).
  • Claim: The parts' default colour gets no override, and an explicit secondary reads as that default (verified: code and unit test).
  • Claim: The CLI single and family builds write the same sub-layers, and an older Core keeps one layer (verified: CLI build tests).
  • Claim: The new layered outputs are opt-in, and each function returns what it did without the option (verified: generated API delta and contract test).
  • Claim: No component, prop, token or default changes (verified: generated API delta; both defaults stay secondary).
  • Claim: Stage order holds inside each sub-layer, and a part's root entry beats its host's later-stage entries (verified: unit tests).
  • Claim: The Chromium precedence spec fails on earlier heads and passes here (not verified: the spec was not run).
  • Claim: The Core theme suites, the CLI theme build suites and the knowledge check pass (verified by rerunning them; ESLint, Prettier, the type check and the CLI structure check were not rerun).
  • Claim (changeset): A part's entry beats its host's entries whatever their selectors, and the runtime and CLI write the same CSS (verified, except the colour-keyed Timestamp and Timer case above).
  • Claim (changeset): Pagination's cell entries win over button entries whatever their keys (verified: unit test).
  • Files: generateThemeRules.ts (two blocking findings, one comment-style note); theme-compilation.md (one row note); sharedElementParts.ts, index.ts, Timer.tsx, Timestamp.tsx, build.mjs, family.mjs, type.ts, generate-data.mjs, theming-doc.mjs, Pagination.spec.md, both changesets, the story, the Chromium spec, the four other test files and the 38 component doc files (clear).

Automated review (maintainer link)

Comment thread docs/architecture/theme-compilation.md Resolved
josephfarina added a commit that referenced this pull request Nov 19, 2026
Timer keeps both imports: the shared default color and main's elapsed-duration formatter.

[skip ci]
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 20, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec a0de682

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 20, 2026
josephfarina added a commit that referenced this pull request Nov 20, 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 two Timestamp and Timer theme cases from the last review still draw the wrong colour. This head only merges main; the sub-layer fix works and its record changes are approved for this head, but the Text overrides copied onto timestamp and timer still need two fixes:

  • Miss: a colour-keyed timestamp or timer entry such as timestamp: {'color:accent': {color: 'red'}} never paints on a Timestamp with that color, because the copied Text override follows it at the same weight (generateThemeRules.ts:1289-1296), which contradicts component:Timestamp AV2, so skip the copy for a colour or size the part's own entries key on, or amend AV2.
  • A caller's color or size on a Timestamp or Timer loses the theme's keyed text entry when that entry and the part's entry sit at different stages (root, an adaptation, onDark or onLight), because the keyed copies come only from the same stage (generateThemeRules.ts:1284, :1302-1324), against INV22's "draws as it would with no part entry", so copy the keyed entries of every stage that applies and add those cases to the PartPrecedence story.

The earlier non-blocking inline notes still apply. The description's Stack line does not hold, because #12450 is not built on this head, so this pull request was reviewed on its own.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.
  • Claim: before the change, a keyed button entry beat the toggle-button entry on a ghost toggle button (verified: Chromium on the base keeps the button fill).
  • Claim: after the change, the toggle-button rule sits in a later parts sub-layer and wins (verified: Chromium on this head takes the toggle-button fill; unit test).
  • Claim: a theme with no part entry compiles byte for byte as before (verified: unit test and CLI build test pass on this head).
  • Claim: four official themes build identically, and three move only their part rules with no visible change (verified for the built CSS: neutral, stone, matcha and chocolate are byte-identical, and butter, gothic and y2k only gain the sub-layer wrappers around the same rules; the visual sameness is the author's screenshots).
  • Claim: the new regression test fails without the change (verified by reading: the module it imports does not exist on the base).
  • Claim: forty-six targets in thirty-eight doc files name the target they sit on, and the compiler's list matches them (verified: count and unit test).
  • Claim: a part's rules follow a flipped surface's dark-page side (verified: unit tests).
  • Claim: Pagination cell entries win over button entries whatever their keys (verified: unit test).
  • Claim: for Timestamp and Timer, a prop the caller sets draws as it would with no part entry (false: fails in Chromium for a colour-keyed part entry and for entries at different stages).
  • Claim: a plain Text draws the same with or without the part entries (verified: Chromium and unit test).
  • Claim: the parts' default colour gets no override, and an explicit secondary reads as that default (verified: code and unit test).
  • Claim: the CLI single and family builds write the same sub-layers, and an older Core keeps one layer (verified: CLI build tests pass on this head).
  • Claim: the layered outputs are opt-in, and each function returns what it did without the option (verified: generated API delta and contract test).
  • Claim: no component, prop, token or default changes (verified: generated API delta; both default colours stay secondary).
  • Claim: stage order holds inside each sub-layer, and a part's root entry beats its host's later-stage entries (verified: unit tests).
  • Claim: the Chromium precedence spec fails on earlier heads and passes here (not verified: the spec was not run).
  • Claim: the Core theme suites, the CLI theme build suites, the knowledge check and Prettier pass (verified on this head; ESLint, the type check and the CLI structure check were not rerun).
  • Claim (changeset): a part's entry beats its host's entries whatever their selectors, and the runtime and CLI write the same CSS (verified, except the Timestamp and Timer colour cases above).
  • Claim (changesets): Pagination's cell entries win over button entries whatever their keys (verified: unit test).
  • Files: generateThemeRules.ts (two blocking findings, one comment-style note); theme-compilation.md (one row note); Timer.tsx (the merge keeps both imports: clear); sharedElementParts.ts, index.ts, Timestamp.tsx, build.mjs, family.mjs, type.ts, generate-data.mjs, theming-doc.mjs, Pagination.spec.md, both changesets, the story, the Chromium spec, the five other test files and the 38 component doc files (clear).

Automated review (maintainer link)

…entries come before Text's prop overrides, in every layer, root entries first

The PartPrecedence story and spec add one-key color/size entries and part entries in an adaptation and on a dark surface, in colors that clear 4.5:1. INV22 says an explicit color="secondary" reads as the default; the changeset names the new win over a part entry.

[skip ci]
…s sub-layer; the precedence spec proves the sub-layers change nothing on Text, Timestamp or Timer

Text's prop overrides decide on Text's element by weight and order, so its parts are not split out. Timer and Timestamp are back to main. The prop-replay work moves to a follow-up.

[skip ci]
…s one in its part's; the timestamp and timer targets are named where they stay beside Text
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 20, 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.

Approval waits on an engineering owner's spec approval for this head; the review found no blocking defect. The record changes the fix depends on (architecture:theme-compilation INV22, INV4 and INV12; component:Pagination FR20 and its DEC-4 paragraph) and the Core theme exports INV22 introduces were approved for an earlier head only, and this head rewrites INV22 (Timestamp and Timer stay beside Text; the new !important exception). An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, which the author may do as an engineering owner.

  • Non-blocking: name sharedElementParts.test.ts in Pagination FR20's verification row, and split the 30-word ComponentGroup comment (inline notes).
Claims and files checked

Review mode: full; reason: spec-record

Claims:

  • On main a keyed button entry beats a part's entry on the same element: verified (Chromium: a ghost ToggleButton keeps the button grey).
  • With a part entry the theme's rules sit in components then parts, so the part wins: verified (generateThemeRules.ts layeredThemeCSS; Chromium: the ToggleButton turns yellow; sharedElementParts.test.ts).
  • A theme with no part entry writes the same CSS byte for byte: verified (the early return in layeredThemeCSS; four published themes build byte-identical).
  • 44 doc targets declare sitsOn, the compiler list matches, and a test keeps them equal: verified (every doc block of every listed target carries the matching value).
  • Parts follow a flipped surface's dark-page side like other rules: verified (flipped-surface tests pass).
  • Pagination's cells win over keyed button entries, and FR20 and DEC-4 say so: verified (Chromium: the current cell turns blue; Pagination.spec.md:141, :380).
  • Timestamp and Timer draw exactly as on main: verified (480 colour and size readings of the PartPrecedence story match).
  • The CLI's single and family builds write the same sub-layers, and an older Core keeps one layer: verified (build.shared-element-parts.test.mjs, build.packed-old-core.test.mjs pass).
  • Without {layered: true} every generator returns what it did before: verified (the unlayered branches; publicThemeHelperContract.test.ts).
  • A part's root entry beats its host's adaptation and media-surface entries: verified (layer order; sharedElementParts.test.ts).
  • An !important value in the host's entry beats one in the part's: verified (CSS reverses layer order for important declarations; the test pins where both land).
  • Butter, gothic and y2k only move part rules into parts and draw the same: verified (same declarations; no host rule outranked a moved part rule on main); their screenshots were not retaken.
  • The new regression test fails without the change: verified (it needs the new module and asserts the new sub-layer).
  • 37 component docs change: verified.
  • The listed suites, the knowledge check, ESLint, Prettier and the core typecheck pass: verified for those run here (Core theme, Pagination and CLI theme suites, the older-Core build suite, the docsite projection test, the knowledge check, ESLint, Prettier on .ts/.tsx/.md, Core's build typecheck); the CLI structure check was not run.
  • The fix moves nothing else: verified for the theme's own rules, which keep their order in components; app CSS written directly in @layer astryx-theme, outside the sub-layers, would now outrank a layered theme's rules (predicted, not demonstrated).
  • The story's fixed colours clear 4.5:1: verified (lowest 7.38:1 on white and 10.73:1 on the dark surface).
  • The accessibility-spec leg picks up the new Chromium spec by its file name, with no workflow change: verified (the Playwright config's spec globs).
  • The record changes need an engineering owner's approval at this head: verified; none exists yet.
  • Both changesets (cells win whatever their keys; a part's entry wins over its host's): verified against the above.

Files:

  • .changeset/core-pagination-strip-targets.md, .changeset/theme-part-wins-over-component-it-sits-on.md: clear.
  • apps/docsite/scripts/generate-data.mjs, apps/docsite/scripts/lib/theming-doc.mjs: clear.
  • apps/storybook/stories/ThemePartPrecedence.stories.tsx: clear.
  • docs/architecture/theme-compilation.md: waits on owner approval for this head.
  • docs/specs/components/Pagination/Pagination.spec.md: waits on owner approval for this head; non-blocking verification-row note.
  • packages/cli/api/theme/build/build.mjs, packages/cli/api/theme/build/family.mjs: clear.
  • packages/cli/api/theme/build/build.packed-old-core.test.mjs, packages/cli/api/theme/build/build.shared-element-parts.test.mjs: clear.
  • packages/cli/authoring/doctypes/base/type.ts, packages/cli/foundation/discovery/theming-targets.test.mjs: clear.
  • The .doc.mjs files of AlertDialog, AppShell, Banner, Calendar, Chat, CheckboxInput, CheckboxList, ClickableCard, CodeBlock, ComplexSelector, DateInput, DateRangeInput, DateTimeInput, Dialog, DialogHeader, Drawer, DrawerHeader, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuDivider, DropdownMenuItem, Field, FieldStatus, FileInput, List, Markdown, MoreMenu, MultiSelector, Pagination, RadioList, SelectableCard, Selector, Switch, Timestamp, Toast, ToggleButton, Typeahead under packages/core/src/: clear.
  • packages/core/src/theme/__tests__/partPrecedence.a11y.chromium.spec.ts: clear.
  • packages/core/src/theme/generateThemeRules.ts: clear; non-blocking comment note.
  • packages/core/src/theme/index.ts: clear; its new exports are in the approval request.
  • packages/core/src/theme/publicThemeHelperContract.test.ts, packages/core/src/theme/sharedElementParts.test.ts, packages/core/src/theme/sharedElementParts.ts: clear.

Automated review (maintainer link)

@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.

Approval waits on an engineering owner's spec approval for this head; the review found no blocking defect.

The fix depends on record changes no current record states yet: architecture:theme-compilation INV22 with amended INV4 and INV12 and the Core outputs INV22 introduces (THEME_SUB_LAYER_ORDER, ThemeLayerOptions, the {layered: true} option with its parts outputs, and sitsOn), and the rewrite of component:Pagination FR20 and DEC-4. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.

  • Non-blocking: the decision should say whether INV22's "each such part" covers Lab targets, since six MediaPlayer buttons on Button's element (media-play-button and five more) stay unlisted while transfer-list-item and media-captions-button are now listed.
  • Non-blocking: Pagination FR20's verification row and verified_by do not name sharedElementParts.test.ts, which FR20's basis now cites.
Claims and files checked

Review mode: full; reason: spec-record

Claims:

  • Before the change, a variant-keyed button entry beat a part's entry on the same element: verified (base fixture frame, ghost ToggleButton grey).
  • With a listed part's entry, the theme's rules sit in a components then a parts sub-layer, the part's rules last: verified (shared-element-parts unit tests; head fixture frame).
  • A theme with no such entry writes the same CSS byte for byte: verified (no-part unit and CLI tests; four official themes build identical).
  • 46 targets name the target they sit on, and a test keeps that list equal to the compiler's: verified (parity test passes; list of 46 entries).
  • Root, adaptation and media-surface order holds inside each sub-layer, and the colour-scheme rules stay outside both: verified (order tests; CLI build test).
  • Part rules follow a flipped surface's dark-page side at every stage: verified (three flip tests).
  • Pagination's cells now win over button entries whatever their keys: verified (pager test; fixture cell borders).
  • Timestamp and Timer draw as before: verified (Chromium story probe, 240 colour and size pairs equal).
  • Single and family CLI builds write the same sub-layers, and a build with an older Core keeps one layer: verified (CLI build tests, packed older-Core tests).
  • The new outputs appear only with the layered option; without it each function returns what it did: verified (public helper contract test; API surface diff).
  • When both entries mark a value important, the component's entry wins: verified (test pins both values; CSS reverses layer order for important declarations).
  • Butter, gothic and y2k move only their named part rules and draw the same: verified (both trees built; static cascade check of the moved rules); the screenshots are the author's own evidence.
  • The new unit test fails without the change: verified (it imports a module the base does not have).
  • Lab's transfer list item and captions button share the parts sub-layer with the parts they sit on: verified (Lab parts test).
  • The Chromium spec runs in the existing accessibility leg by its file pattern: verified (the accessibility spec glob matches it).
  • Six Lab media buttons on Button's element are a follow-up and behave as on main: verified (they render IconButton or Button and are unlisted).
  • Both release notes describe the shipped behavior for the listed parts: verified; the "each such target names sitsOn" sentence holds for Core, not for the six Lab media buttons (non-blocking).
  • The named suites, knowledge check, ESLint, Prettier and Core typecheck pass: verified at this head, the CLI structure check included.

Files:

  • packages/core/src/theme/generateThemeRules.ts, sharedElementParts.ts, index.ts: clear.
  • packages/cli/api/theme/build/build.mjs, family.mjs: clear.
  • docs/architecture/theme-compilation.md: held for owner approval; non-blocking note on the Lab wording.
  • docs/specs/components/Pagination/Pagination.spec.md: held for owner approval; non-blocking note on FR20's verification row.
  • .changeset/theme-part-wins-over-component-it-sits-on.md, .changeset/core-pagination-strip-targets.md: clear for the published packages.
  • 37 Core component docs (AlertDialog, AppShell, Banner, Calendar, Chat, CheckboxInput, CheckboxList, ClickableCard, CodeBlock, ComplexSelector, DateInput, DateRangeInput, DateTimeInput, Dialog, DialogHeader, Drawer, DrawerHeader, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuDivider, DropdownMenuItem, Field, FieldStatus, FileInput, List, Markdown, MoreMenu, MultiSelector, Pagination, RadioList, SelectableCard, Selector, Switch, Timestamp, Toast, ToggleButton, Typeahead): clear, each host checked against the element its part renders on.
  • packages/lab/src/MediaPlayer/MediaPlayer.doc.mjs, packages/lab/src/TransferList/TransferList.doc.mjs: clear.
  • packages/cli/authoring/doctypes/base/type.ts, apps/docsite/scripts/generate-data.mjs, apps/docsite/scripts/lib/theming-doc.mjs: clear.
  • Tests and story (sharedElementParts.test.ts, publicThemeHelperContract.test.ts, partPrecedence.a11y.chromium.spec.ts, ThemePartPrecedence.stories.tsx, build.shared-element-parts.test.mjs, build.packed-old-core.test.mjs, theming-targets.test.mjs): clear, all pass at this head.

Automated review (maintainer link)

- **INV22 — A part on another component's element wins over that component's
entries.** Some targets sit on the element of a component they render, beside
that component's own target (a toggle button's `toggle-button` on Button's
element, beside `button`). Each such part names that target as `sitsOn` on

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: "Each such part names that target as sitsOn" now reads as covering Lab, since this head lists transfer-list-item and media-captions-button. Six other Lab MediaPlayer targets also sit on Button's element through IconButton or Button and stay unlisted: media-play-button, media-seek-button, media-volume-button, media-fullscreen-button, media-playback-rate-button (MediaPlayerControls.tsx) and media-track-button (AudioPlayer.tsx). Either list them, or limit the sentence to the parts SHARED_ELEMENT_PARTS names.

| FR17 | A plain activation of a page link runs FR6, with the same `onChange(page)` call as a button control. Pagination does not cancel the click, so the link navigates, and the caller does not navigate in `onChange` for it. The browser follows the URL that was activated: the page change gives a Previous or Next link its next URL only after the click is over. A click that does not navigate this document runs none of FR6, because the page here did not change: a click with a modifier key (Control, Meta, Shift, or Alt), a click on a link whose `target` is set and is not `_self`, and a click on a link whose URL is rejected. | DEC-1; DEC-3; current tests |
| FR18 | The dots (FR9), the Page input (FR10), and the Page-size selector (FR11) are never links (DEC-2). With `getPageHref` they keep FR9 to FR11 and change the page through FR6. In the `dots` and `input` variants only Previous, Next, First, and Last are links. `onChange` receives the page alone from every control (DEC-3), so it does not tell a link, which navigates, from a dot or the Page input, which do not. A page-size choice calls `onPageSizeChange(size)` and then `onChange(1)`. | DEC-2; DEC-3; current tests |
| FR19 | Button replaces the element of a control that stops or starts being a link (`component:Button` FR11): a link that becomes unavailable, at a boundary or while `isDisabled`, is a disabled button, and that button is a link when the control is available again. When the element that leaves holds focus, Pagination moves the focus to the element that replaces it in the same change, through Core's shared owner of that replacement (`architecture:react-component-runtime` INV16). The focus indicator follows the last input: it shows after a key press and not after a pointer press (`architecture:interaction-modality` INV1). The control then holds focus as a button control does (FR13; `spec:AST-085` FR4, FR7). Pagination moves no focus for a control that did not hold it, and none when another element holds focus after the change. | `spec:AST-085` FR4, FR7; `component:Button` FR11; current source and tests |
| FR20 | The control row carries `pagination-list` with `data-variant` and `data-size`. Each Button control in it (page numbers, previous and next, first and last) carries `pagination-item`, and the current page's reflects `data-selected="selected"` beside its `aria-current="page"`, and the first and last control in the row reflect `data-first="first"` and `data-last="last"`; an ellipsis carries `pagination-ellipsis`. A theme styles the row as one joined strip through these targets, apart from other Buttons (DEC-4): the row's border, radius and shadow, and the ellipsis. A cell's own entries (a border between cells, its hover, the current cell's fill) win over the theme's `button` entries on the same element, whatever their keys: `pagination-item` sits on Button's element (`architecture:theme-compilation` INV22). With no theme rule, Pagination looks as before. | Current source, `Pagination.targets.test.tsx` and `sharedElementParts.test.ts` |

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: FR20's basis now cites sharedElementParts.test.ts, but FR20's Verification row (line 291) and the record's verified_by still name only Pagination.targets.test.tsx and themingTargets.test.ts. Neither of those checks that a cell's entry beats a keyed button entry. Add the test to both.

@josephfarina

Copy link
Copy Markdown
Contributor Author

Engineering owner's approval for the record changes at this head (architecture:theme-compilation INV22, INV4 and INV12 with their rows, and component:Pagination FR20 and DEC-4), so the repository's spec gate is clear. The design owner's GitHub review is still required before this merges.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 1ad0fd4

@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: one regression from main's release. The record changes now have an engineering owner's approval for this head, and the sub-layer fix itself checks out.

  • Regression: main's 0.7.17 release deleted .changeset/core-pagination-strip-targets.md, which this pull request edits, so the branch conflicts with main; merge main, take the deletion, and say in .changeset/theme-part-wins-over-component-it-sits-on.md that Pagination's pagination-item entries now win over keyed button entries, since the released 0.7.17 note says they lose to them.

The merge makes a new head, so the record changes need /approve-spec for that head again. The two non-blocking notes on INV22's wording for Lab's MediaPlayer buttons and on FR20's verification row still stand.

Claims and files checked

Review mode: same-head; reason: none

Claims:

  • An engineering owner approves the record changes at this head: verified (an exact-head approval comment from an engineering owner; the spec-owner-approval status succeeds).
  • Before the change, a variant-keyed button entry beat a part's entry on the same element: verified (base fixture frame, ghost ToggleButton grey).
  • With a listed part's entry, the theme's rules sit in a components then a parts sub-layer, the part's rules last: verified (shared-element-parts unit tests; head fixture frame).
  • A theme with no such entry writes the same CSS byte for byte: verified (no-part unit and CLI tests; four official themes build identical).
  • 46 targets name the target they sit on, and a test keeps that list equal to the compiler's: verified (parity test; 46 list entries).
  • Root, adaptation and media-surface order holds inside each sub-layer, and the colour-scheme rules stay outside both: verified (order tests; CLI build test).
  • Part rules follow a flipped surface's dark-page side at every stage: verified (three flip tests).
  • Pagination's cells now win over button entries whatever their keys: verified (pager test; fixture cell borders).
  • Timestamp and Timer draw as before: verified (Chromium story probe, 240 colour and size pairs equal).
  • Single and family CLI builds write the same sub-layers, and a build with an older Core keeps one layer: verified (CLI build tests, packed older-Core tests).
  • The new outputs appear only with the layered option; without it each function returns what it did: verified (public helper contract test; API surface diff).
  • When both entries mark a value important, the component's entry wins: verified (test pins both values; CSS reverses layer order for important declarations).
  • Butter, gothic and y2k move only their named part rules and draw the same: verified (both trees built; static cascade check of the moved rules).
  • The new unit test fails without the change: verified (it imports a module the base does not have).
  • Lab's transfer list item and captions button share the parts sub-layer with the parts they sit on: verified (Lab parts test).
  • The Chromium spec runs in the existing accessibility leg by its file pattern: verified (the accessibility spec glob matches it).
  • Six Lab media buttons on Button's element are a follow-up and behave as on main: verified (they render IconButton or Button and are unlisted).
  • The new release note describes the shipped behavior for the listed parts: verified. The edited Pagination strip-targets note: its text is accurate, but main has released and deleted that note, so the edit conflicts (blocking regression above).
  • The named suites, knowledge check, ESLint, Prettier and Core typecheck pass: verified at this head.

Files:

  • .changeset/core-pagination-strip-targets.md: regression (released and deleted on main; modify/delete conflict).
  • .changeset/theme-part-wins-over-component-it-sits-on.md: clear; add the Pagination sentence when resolving the conflict.
  • packages/core/src/theme/generateThemeRules.ts, sharedElementParts.ts, index.ts: clear.
  • packages/cli/api/theme/build/build.mjs, family.mjs: clear.
  • docs/architecture/theme-compilation.md: owner-approved; non-blocking note on the Lab wording.
  • docs/specs/components/Pagination/Pagination.spec.md: owner-approved; non-blocking note on FR20's verification row.
  • 37 Core component docs (AlertDialog, AppShell, Banner, Calendar, Chat, CheckboxInput, CheckboxList, ClickableCard, CodeBlock, ComplexSelector, DateInput, DateRangeInput, DateTimeInput, Dialog, DialogHeader, Drawer, DrawerHeader, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuDivider, DropdownMenuItem, Field, FieldStatus, FileInput, List, Markdown, MoreMenu, MultiSelector, Pagination, RadioList, SelectableCard, Selector, Switch, Timestamp, Toast, ToggleButton, Typeahead): clear, each host matches the element its part renders on.
  • packages/lab/src/MediaPlayer/MediaPlayer.doc.mjs, packages/lab/src/TransferList/TransferList.doc.mjs: clear.
  • packages/cli/authoring/doctypes/base/type.ts, apps/docsite/scripts/generate-data.mjs, apps/docsite/scripts/lib/theming-doc.mjs: clear.
  • Tests and story (sharedElementParts.test.ts, publicThemeHelperContract.test.ts, partPrecedence.a11y.chromium.spec.ts, ThemePartPrecedence.stories.tsx, build.shared-element-parts.test.mjs, build.packed-old-core.test.mjs, theming-targets.test.mjs): clear.

Automated review (maintainer link)

---

[feat] Themes can draw Pagination's controls as one joined strip. The control row carries `pagination-list`, each of its Button controls carries `pagination-item` (the current page's reflects `data-selected`), and the ellipsis carries `pagination-ellipsis`. On the cells, `pagination-item` competes with the theme's `button` entries: its base rule loses to a `button` entry keyed on variant, size or elevation, and its hover and selected rules weigh the same as a one-key `button` rule, so the later one in the theme wins. The default look does not change.
[feat] Themes can draw Pagination's controls as one joined strip. The control row carries `pagination-list`, each of its Button controls carries `pagination-item` (the current page's reflects `data-selected`), and the ellipsis carries `pagination-ellipsis`. A theme's `pagination-item` entries win over its `button` entries on the cells, whatever their keys. The default look does not change.

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.

Regression: main's 0.7.17 release deleted this file (its text shipped in packages/core/CHANGELOG.md under 0.7.17), so this edit now conflicts with main. Merge main and take the deletion. The released note says the pagination-item base rule loses to a keyed button entry, so say in .changeset/theme-part-wins-over-component-it-sits-on.md that Pagination's cells now win over keyed button entries.

This branch was successfully deployed

1 active deployment
Preview — 1ad0fd4e Deployed Nov 21, 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