Skip to content

docs(Rating): add the draft component record - #12815

Draft
cixzhang wants to merge 8 commits into
mainfrom
docs/rating-record
Draft

cixzhang wants to merge 8 commits into
mainfrom
docs/rating-record

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

Summary

This adds the draft component:Rating record. It states the contract of the Lab Rating that Rajatendu1 contributed in #11082:

  • Props: a controlled API (label, value/onChange, max, size, a focusable isDisabled, isReadOnly, allowClear, getStarLabel).
  • Keyboard: the radio-group model. Down and the inline-end arrow raise the rating, Up and the inline-start arrow lower it. There is no wrap, Home and End pick the ends, and a modified key does nothing.
  • Touch: the action-groups family's slide-and-lift choice.
  • Read-only: one image, with the last star partly filled from the inline start.
  • Colour roles: --color-icon-yellow filled, --color-border-emphasized empty, --color-text-disabled disabled; Highlight and CanvasText under forced colours.

The record is authority: draft with owners: [cixzhang]. It becomes the governing record once an engineering owner approves it at this head.

Open question for the owner (OQ1): does Down raise the rating, as it moves to the next radio in a radio group (as built), or lower it, as on a vertical scale?

Stack: #11082 → this. The branch sits on #11082's Lab-only head, so the record's doc and test links resolve. Review only docs/specs/components/Rating/Rating.spec.md; the other files are #11082's and merge there.

Credit: the component, its docs and tests are Rajatendu1's (#11082). This pull request only adds the record.

Writing rubric results

Rule Result
R1 present tense Pass. The record states the system.
R2 no research Pass.
R3 facts, not changes Pass. Basis cells name patterns and records.
R4 rejected alternatives Pass. None are recorded.
R5 no PR or issue refs Pass.
R6 answered questions collapsed Pass. OQ1 is unanswered, so it keeps its two options.
R7 no project status Pass. Only the template's "not yet released" lifecycle field remains.

pnpm check:knowledge: the records are aligned (run with #11082's Rating doc in the tree).

Overlap checked: #11082 (the Lab Rating this record describes; it merges first and stays Lab-only)

Instinct Agent and others added 6 commits November 11, 2026 08:20
The internal/touch re-exports, their identity test, the two header comments, and the two catalog messages move to their own Core pull request, #11283 (its changeset covers the catalog), so this one changes only Lab and the CLI's discover list. It merges after #11283.

Co-authored-by: Rajatendu1 <[email protected]>
The record states Rating's candidate contract for engineering-owner
approval: the controlled API, the radio-group keyboard model, the
action-groups touch choice, the read-only image, and the colour roles.
This pull request stays Lab-only; the draft record lands separately for
engineering-owner approval.
States Rating's candidate contract for engineering-owner approval: the
controlled API, the radio-group keyboard model, the action-groups touch
choice, the read-only image, and the colour roles. The component is
Rajatendu1's contribution.
@vercel

vercel Bot commented Nov 19, 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 19, 2026 7:15am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 19, 2026, 7:44 AM UTC

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

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

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


Generated by PR Enrichment workflow | View current CI run

@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 decision on the draft component:Rating record, and two fixes are needed whatever that decision is.

The record adds requirements that no current record states yet (FR1–FR4, FR7, AR1–AR5, ORD1–ORD3, DD1–DD2 and the public concepts). It also leaves two decisions open: OQ1, whether Down raises or lowers the rating, and whether allowClear should use the system's existing hasClear name. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. An amended record needs a new head.

  • Empty star outlines use --color-border-emphasized (DD1 at Rating.spec.md:184, Rating.tsx:85) and measure 1.48:1 on white, below the 3:1 that architecture:theme-tokens INV13 requires for a radio's only visible edge; DD1 should name --color-border-control and the build should use a role that meets 3:1.
  • Shift with an arrow key, Home or End still changes the rating because Rating.tsx:310-312 ignores only Alt, Control and Meta, which contradicts FR3 and the description's "a modified key does nothing"; add event.shiftKey to that guard or narrow FR3 to Control, Meta and Alt chords.
Claims and files checked

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

  • Claim: adds the draft Rating record with owner cixzhang: verified (record frontmatter).
  • Claim: the record's props match the controlled Lab API: verified (Rating.tsx RatingProps).
  • Claim: Down and the inline-end arrow raise the rating, Up and the inline-start arrow lower it, arrows do not wrap, Home and End pick the ends: verified (keyboard and right-to-left tests).
  • Claim: a modified key does nothing: false, because Shift moves and commits (Rating.tsx:310-312; browser capture).
  • Claim: touch uses the action-groups slide-and-lift: verified (10 pointer-stream tests).
  • Claim: read-only is one image whose last star fills from the inline start: verified (tests; right-to-left capture).
  • Claim: the colour roles and forced-colour roles are as listed: verified (Rating.tsx styles), though the empty-outline role fails 3:1 (finding above).
  • Claim: the branch sits on #11082 and only the record is new here: verified (the diff from #11082's head changes only the record).
  • Claim: the writing rubric R1–R7 passes: verified.
  • Claim: the knowledge check reports the records aligned: verified (run at this head).
  • Changeset: astryx discover lists the experimental Rating: verified (the generated list is current).
  • .changeset/cli-discover-rating.md: clear
  • apps/storybook/stories/Rating.stories.tsx: clear
  • docs/specs/components/Rating/Rating.spec.md: owner decision pending; DD1 contrast; FR3 wording
  • internal/shadcn-registry/routes.lock.json: clear
  • packages/cli/assets/discover/official-packages.json: clear
  • packages/lab/src/Rating/Rating.doc.mjs: clear
  • packages/lab/src/Rating/Rating.test.tsx: clear
  • packages/lab/src/Rating/Rating.tsx: empty-outline contrast; Shift guard
  • packages/lab/src/Rating/RatingTracking.test.tsx: clear
  • packages/lab/src/Rating/index.ts: clear
  • packages/lab/src/Rating/rating.stylex.ts: clear
  • packages/lab/src/index.ts: clear

Automated review (maintainer link)


| ID | Decision | Intent or reason | Applies to | Allowed variation |
| --- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------- | ------------------------- |
| DD1 | Filled stars use `--color-icon-yellow`; empty star outlines use `--color-border-emphasized`; disabled filled stars use `--color-text-disabled`. | The rating color reads as a score; the outline keeps empty stars visible. | every star | themes repaint the tokens |

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.

Empty star outlines are each unchosen radio's only visible edge, and --color-border-emphasized measures 1.48:1 on white in the light Storybook. architecture:theme-tokens INV13 asks for 3:1 on that edge and gives controls --color-border-control. Could DD1 name that role?

Comment on lines +310 to +312
event.altKey ||
event.ctrlKey ||
event.metaKey

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.

Shift isn't in this guard, and useListFocus ignores only Control, Meta and Alt, so Tab, then Shift+ArrowRight or Shift+End, commits a star. FR3 in the record says "A modified key MUST do nothing". Add event.shiftKey || here, or narrow FR3 to Control, Meta and Alt chords.

Without a forced-colours value, the disabled colour replaced the filled
star's forced-colours arm, so a disabled Rating drew Highlight fills like
an enabled one. Core paints disabled controls GrayText there.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec d2329f9

@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: an engineering owner approved the component:Rating record at this head, so its requirements are settled, but the Lab build and one design decision still need three fixes.

  • A disabled Rating contradicts the approved DD1 and DD2: filledDisabled (Rating.tsx:414) paints its empty outlines in the disabled colour instead of --color-border-emphasized, and under forced colours they turn GrayText while its chosen stars stay Highlight like an enabled rating, so write the disabled paint into DD1 and DD2 and make the build, with a forced-colours test, match it.
  • Empty star outlines use --color-border-emphasized (DD1 at Rating.spec.md:184, Rating.tsx:88) and measure 1.48:1 on white, below the 3:1 that architecture:theme-tokens INV13 requires for a radio's only visible edge, so DD1 should name --color-border-control and the build should paint a role that meets 3:1.
  • Shift with an arrow key, Home or End still changes the rating because the guard at Rating.tsx:310-316 ignores only Alt, Control and Meta, which contradicts the approved FR3 and the description's "a modified key does nothing", so add event.shiftKey there or narrow FR3 to Control, Meta and Alt chords.

An amended record needs a fresh /approve-spec at its new head.

Claims and files checked

Review mode: same-head; reason: none

  • changed rules (0): none
  • Claim: adds the draft Rating record with one owner: verified (record frontmatter).
  • Claim: the record governs once an engineering owner approves it at this head: an engineering owner approved it at this head.
  • Claim: the record's props match the controlled Lab API: verified (Rating.tsx RatingProps).
  • Claim: Down and the inline-end arrow raise the rating, Up and the inline-start arrow lower it: verified (keyboard and right-to-left tests).
  • Claim: arrows do not wrap, and Home and End pick the ends: verified (keyboard tests).
  • Claim: a modified key does nothing: false, because Shift with an arrow, Home or End commits (Rating.tsx:310-316; Storybook).
  • Claim: touch uses the action-groups slide-and-lift: verified (10 pointer-stream tests).
  • Claim: read-only is one image whose last star fills partway from the inline start: verified (tests; Storybook).
  • Claim: filled, empty and disabled stars use the yellow icon, emphasized border and disabled text roles: verified for enabled stars; a disabled rating also paints its empty outlines in the disabled role (finding above).
  • Claim: forced colours use Highlight and CanvasText: false for a disabled rating, whose empty outlines paint GrayText (Rating.tsx:67-72).
  • Claim: the branch carries #11082's Lab files and only the record is new here: verified (the diff from #11082's carried commit changes only the record).
  • Claim: the writing rubric R1–R7 passes: verified.
  • Claim: the knowledge check reports the records aligned: verified (run at this head).
  • Changeset: astryx discover lists the experimental Rating: verified (the generated list is current).
  • .changeset/cli-discover-rating.md: clear
  • apps/storybook/stories/Rating.stories.tsx: clear
  • docs/specs/components/Rating/Rating.spec.md: owner-approved; DD1 contrast against INV13
  • internal/shadcn-registry/routes.lock.json: clear
  • packages/cli/assets/discover/official-packages.json: clear
  • packages/lab/src/Rating/Rating.doc.mjs: clear
  • packages/lab/src/Rating/Rating.test.tsx: clear
  • packages/lab/src/Rating/Rating.tsx: disabled paint; empty-outline contrast; Shift guard
  • packages/lab/src/Rating/RatingTracking.test.tsx: clear
  • packages/lab/src/Rating/index.ts: clear
  • packages/lab/src/Rating/rating.stylex.ts: clear
  • packages/lab/src/index.ts: clear

Automated review (maintainer link)

styles.empty,
!partial && fill === 1 && styles.filled,
isInteractive && styles.interactivePath,
isDisabled && styles.filledDisabled,

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.

This adds filledDisabled to empty stars too, so a disabled rating's empty outlines paint --color-text-disabled (DD1 says --color-border-emphasized) and GrayText under forced colours (DD2 says CanvasText). Its chosen stars keep filled's separate Highlight key, so they still look enabled. Could DD1 and DD2 state the disabled paint, with filled's and empty's forced-colours arms folded into their color objects so this style replaces them?

@cixzhang cixzhang added ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) lane:3 Astryx fix-loop lane 3 owns this labels Nov 21, 2026

This branch was successfully deployed

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

Labels

ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot. lane:3 Astryx fix-loop lane 3 owns this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant