Skip to content

feat(lab): add Rating, a star rating input and read-only display - #11082

Draft
Rajatendu1 wants to merge 17 commits into
meta:mainfrom
Rajatendu1:feat/lab-rating-contract
Draft

Rajatendu1 wants to merge 17 commits into
meta:mainfrom
Rajatendu1:feat/lab-rating-contract

Conversation

@Rajatendu1

@Rajatendu1 Rajatendu1 commented Nov 10, 2026 •

Copy link
Copy Markdown

#11283, which carries this PR's Core changes (the internal/touch re-exports for group press tracking and Rating's two catalog messages), is merged, and main is merged in. This PR changes Lab, its story, the CLI's discover list and its changeset, the generated shadcn route-lock entry, and a lab__Rating sample in the swizzle proof's samples.

User need

Product pages that ask people to rate something, such as a recipe, a support answer or a product, need a star input, and pages that show a product's average need a star display. Today each team builds its own, and those often miss radio semantics, a single tab stop, keyboard control, touch slide-and-lift, or a text name that screen readers can read. A reusable rating input saves callers from rebuilding radio semantics, focus, keyboard controls and pointer interaction. A read-only mode displays a fractional average. This is an experimental Lab proposal, not a core API.

Problem and solution fit

  • Controlled whole-star input: a named radiogroup, one tab stop, shared useListFocus navigation without wrapping, Home/End, Space/Enter and optional clear. Horizontal arrows follow text direction; Down advances and Up retreats, following the shared list model. Navigation never clears an already-selected boundary; explicit click, Space or Enter can clear it.
  • Touch presentation: Core's shared group tracker follows a finger or pen and activates only the lifted star. Leaving, cancellation or a second finger selects nothing. Coarse-pointer hit targets expand toward 44px without changing the glyph size. Mouse presses retain native button behavior. Hover preview uses scoped StyleX CSS. An arrow-key, Home, End, Space or Enter choice pauses it until the pointer moves, so it never paints a count other than the value.
  • Read-only display: one named image, fractional inline-start fill and a custom label callback that receives fractional values. Built-in star names and complete read-only names use useTranslator with ICU catalog messages.

Current specification

Follows the action-groups contract for an experimental Rating in packages/lab. Issue #11058 received a positive Lab-only response from cixzhang, who said a maintainer would help with the component record. That record is not supplied here; please advise on it. The automated review also identifies the controlled radio-group API, allowClear and getStarLabel names, arrow-key model, read-only display and wording, and colour roles as decisions for an engineering owner. I am not claiming that design approval. The earlier core proposal #3696 is separate. I am not claiming production demand counts or acceptance of this exact API.

Public delta and caller burden

New experimental Rating, RatingProps and RatingSize exports from @astryxdesign/lab. The caller owns value/onChange and supplies the group label. Supports max, size, isDisabled, isReadOnly, allowClear and getStarLabel. No half-star input. This pull request changes no Core file. The Core half (three exports on Core's internal touch entry for the group tracker, and the two English Rating catalog messages) landed in #11283. Beyond the Lab exports, it adds the Rating story, the generated CLI discover and route-lock entries with a CLI changeset, and a lab__Rating sample for the swizzle proof (Rating has required props). Rating picks the star glyph's size style itself, where it reflects size to themes.

Review corrections

  • Shared focus navigation replaces the copied keyboard and RTL code. Only a navigation focus move selects; Tab, programmatic focus and pointer focus do not commit a rating.
  • Keyboard boundary navigation with allowClear is a no-op, while explicit activation still clears.
  • Caller pointer-leave handlers are no longer replaced; caller keyboard and focus handlers are respected.
  • Scoped CSS handles hover expansion and reduction without state.
  • One SVG per star uses static StyleX sizes. Only a fractional read-only star adds a clipped path, with inline-start clipping in RTL.

Second-review corrections

  • Hovering a gap between stars keeps the committed rating rather than painting all stars empty. Sibling hover selectors replace the group-hover reset.
  • Per-star focus closures replace the internal data-star attribute. Native button clicks handle Enter and Space, with tests for exactly one activation.
  • The read-only element forwards caller key and focus handlers. Read-only SVGs no longer have style-only span wrappers.
  • Focus, fractional-fill, touch-hook, caller docs and changeset wording follow the additional review notes.

Third-review corrections

  • Rating alone owns the value-derived tab stop. The shared focus hook moves focus without also rewriting tabindex. When a caller ignores onChange, Tab re-entry returns to the checked star. (A later correction, below, lets the focused star hold the tab stop while focus is inside the group, so Tab leaves in one press.)
  • The added regression keeps value at 3 and moves focus left to 2. It verifies that the checked star is unchanged and that the focused star holds the tab stop while focus is inside the group. Then it checks that one Tab leaves the group and that Shift+Tab re-enters on the checked star, with no further change request.
  • Caller JSDoc describes the keys rather than the shared hook.

Evidence

49 Rating tests (39 component cases and 10 pointer-stream cases) pass in a sandboxed run, plus a Chromium forced-colours trace. The original implementation passed its original 28 tests but fails five first-review reproduction cases: four unwanted boundary clears and a swallowed caller pointer-leave handler. A broader focused run passes 178 tests versus 177 on the previous corrected head, including shared list focus, ButtonGroup and internal/touch. Three second-review assertions fail on head 08d68b5: read-only handlers, internal data attributes and style-only wrappers. Chrome reproduces the hover-gap bug there too. The third-review regression fails on bcb9c7b, where a no-op onChange leaves the tab stop on an unchecked star.

Real Chrome on a temporary page verifies hover expansion to 4, reduction to 1, restoration of committed 3, retention of committed 3 through all four inter-star gaps, boundary no-clear, explicit clear, keyboard focus, inherited RTL horizontal arrows, fractional clipping in both directions, finger slide/lift selection and outside cancellation. An additional Chrome case verifies the no-op onChange tab stop and re-entry against the submitted head and this correction. This is not the repository's Storybook browser workflow or a visual-regression run.

Validation limits

Whole-Lab TypeScript including tests, Lab doc TypeScript, Lab declaration generation, Babel, Core and Lab CSS builds, cross-package StyleX variable checks, no-dev-JSX and fully-specified imports pass. ESLint, Prettier, package boundaries, changesets, SYNC comments, use-client and i18n catalog checks pass. The temporary browser checks were repeated with runtime StyleX injection disabled and the generated Core astryx.css plus Lab lab.css; all interaction and clipping assertions pass. This uses source-built JavaScript and the generated production CSS, not a packed consumer or Storybook build.

CI, Lint and the CLI smoke test pass at this commit. Still unverified: a real screen reader, the Lab readiness audit, and visual regression (Lab has no stable visual stories).

Latest corrections

  • Forced colours: stars keep system colours in a high-contrast theme. A checked star is Highlight, an empty star CanvasText, and every star of a disabled rating GrayText. Each star style sets its forced-colours colour as an arm of color, so the disabled style replaces it. RatingForcedColors.interaction.browser.spec.ts asserts all three in Chromium's forced-colors emulation, on a touch page and on a hover-capable mouse page. The mouse-page case fails on the earlier head that lost CanvasText.
  • Tab: while focus is inside the group, the focused star holds the tab stop. A blur out of the group hands it back to the checked star, so Tab leaves in one press even when a caller ignores onChange.
  • Hover preview: a key choice (an arrow, Home, End, Space or Enter) pauses the hover preview until the pointer moves.
  • Handlers: caller onBlur and onPointerMove handlers still run, read-only included.
  • These change only forced-colours paint, the paused preview and the tab stop, so the stills below still hold. Forced-colours frames of the enabled and disabled states are added.

Unrated outline contrast

An unrated star's outline uses Core's control-edge border colour today (--color-border-emphasized, about 1.5:1 on white in the Neutral theme), the same token CheckboxInput and RadioList use. That is below WCAG 1.4.11's 3:1 for a control's edge. This pull request waits for Core's 3:1 control-edge colour (--color-border-control, #11658), then adopts it for the unrated outline in one push, so it ships with no known 1.4.11 gap and no Rating-only colour. Real-Chrome stills and measured contrast follow on that head.

Real-Chrome stills

These cover Core and Neutral, in light and dark, at 1280 px and at 390 px with touch emulation, at head dce1ab3 (later commits change only forced-colours paint, the paused preview and the tab stop). The states are empty, partial (read-only 4.3), full (reached by tapping star 5), hover preview, keyboard focus, disabled, read-only, and an RTL read-only fraction that fills from the right. Per-state index: https://raw.githubusercontent.com/vjeux/astryx/01edda1564a3401ac7e994e8a1418a9aa532a06b/index.md

Component record

The draft component:Rating record is in its own records pull request, so this pull request does not wait on its owner approval. A maintainer added the doc's usage.anatomy here. The record does not yet match this branch on four points, and it gets those updates before it is reviewed:

  • in forced colours, every star of a disabled rating paints GrayText;
  • while focus is inside the group, the tab stop is the focused star;
  • a choice key, as well as the pointer leaving, ends the hover preview;
  • the unrated outline uses the 3:1 control-edge colour.

Scope

Components: Rating (Lab exports Rating, RatingProps, RatingSize), its story, and the generated CLI discover and route-lock entries. The Core half landed in #11283.

  • One capability is added.
  • Unrelated cleanup and policy changes are excluded.
  • Consumer docs, story and focused tests ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Patch prepared and tests executed by Instinct, an AI assistant, at my request.

Owner and land path

Owner: the Astryx fix loop, lane 3. Carried by lane 3 for the contributor. main is merged in after #11283. Land path: mixed (Lab plus the CLI discover entry, changeset and swizzle sample; no Lab API owner decision is needed): Specs, CodeBunny, real-Chrome stills and green CI; the drain merges.

@vercel

vercel Bot commented Nov 10, 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 10:44pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 20, 2026, 12:02 AM UTC

@meta-cla

meta-cla Bot commented Nov 10, 2026

Copy link
Copy Markdown

Hi @Rajatendu1!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review labels Nov 10, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 10, 2026
@Rajatendu1
Rajatendu1 force-pushed the feat/lab-rating-contract branch from ea1f898 to d97ed22 Compare November 10, 2026 20:25
@Rajatendu1
Rajatendu1 marked this pull request as ready for review November 10, 2026 20:39

@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 a component record: Rating has no component:Rating spec yet, and the action-groups family covers only its touch slide-and-lift. An engineering owner (you, if you are one) needs to settle the controlled radio-group API (including the clear prop's name beside Core's existing hasClear), the arrow-key model and the read-only display, either by merging a record on main or by approving one in this pull request with /approve-spec <full head SHA>; you do not need to write that record yourself.

These fixes are needed whatever the record decides:

  • With allowClear, ArrowRight or End on a checked last star, or Home on a checked first star, clears the rating, because handleKeyDown calls choose with the star that is already checked (Rating.tsx:284).
  • The arrow, Home/End and tab-stop handling and isRightToLeft copy what Core's useListFocus (from @astryxdesign/core/hooks) already does for SegmentedControl's radio group, so please use the shared hook and delete the copy.
  • The default star names (${star} of ${max} stars) and the read-only ${label}: … name are English literals, but Astryx-owned assistive text must be one catalog message read with useTranslator, as Lab's Chat and Comments do.
  • The group's onPointerLeave={() => setHover(null)} replaces any onPointerLeave a caller passes, and the hover preview it serves belongs in CSS (StyleX sibling markers under @media (hover: hover)) rather than React state.
  • Each filled star renders a second clipped SVG over the outline and sizes itself with inline style objects, where one SVG per star with a styled path and StyleX styles would do.

The touch slide-and-lift, the Core re-export and the right-to-left behaviour look right.

[Automated review]

Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.tsx Resolved
@Rajatendu1
Rajatendu1 force-pushed the feat/lab-rating-contract branch from d97ed22 to 08d68b5 Compare November 10, 2026 21:36
@Rajatendu1

Copy link
Copy Markdown
Author

Updated this same PR as one commit, 08d68b5, and replied to the five implementation comments. The boundary-clear and caller-handler bugs are reproduced by tests. The correction passes 40 Rating tests and 171 focused tests locally; generated Core/Lab CSS and Chrome interaction checks also pass. The PR body has the exact validation limits. Full CI and Storybook are not claimed as passed.

The component:Rating record and engineering-owner decisions remain open. This update does not claim spec approval or settle the clear-prop name. The shared hook's Down=increase / Up=decrease model is now explicit in tests, docs and the PR body. Please advise on the component record and final API/model.

Patch prepared and tests executed by Instinct, an AI assistant, at my request.

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

Thanks for the quick turnaround: all five earlier points are fixed at this head (boundary keys, the shared useListFocus, catalog names, the caller's onPointerLeave, one SVG per star).

Approval still waits on a component record, because Rating has no component:Rating spec and the action-groups family covers only its touch slide-and-lift. An engineering owner needs to settle the controlled radio-group API, the allowClear and getStarLabel names (beside Core's hasClear and ProgressBar's formatValueLabel), the keyboard model, the read-only display and its wording, and the colour roles, either in a record merged on main or by approving an in-PR record with a /approve-spec <full head SHA> comment (the author may do this only if they are an engineering owner).

These need fixing once that is settled:

  • Hovering the 4 px gap between two stars paints every star empty, because the stylex.when.ancestor(':hover', ratingGroup) arm in Rating.tsx empties them all; empty only the stars after the hovered one with stylex.when.siblingBefore(':hover', ratingStar).
  • data-star is a new data attribute used only internally, which architecture:public-component-api DEC-2 rules out; close over star in per-star handlers and let the native button click handle Enter and Space.
  • The read-only branch drops a caller's onKeyDown and onFocus (architecture:public-component-api INV5); forward both to the role="img" element.
  • Miss: each read-only star wraps its SVG in a <span> that only carries styles (architecture:component-style-authoring INV5, INV7); render the SVG directly with those styles.

[Automated review]

Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.doc.mjs Resolved
Comment thread .changeset/cli-discover-rating.md Resolved
@Rajatendu1

Copy link
Copy Markdown
Author

Thanks for confirming the five earlier fixes. I'll reproduce the hover-gap and read-only handler cases and check the remaining implementation and documentation notes before preparing a follow-up. The component record and the engineering-owner decisions are still open; I am not claiming spec approval or settling those choices here.

@Rajatendu1
Rajatendu1 force-pushed the feat/lab-rating-contract branch from 08d68b5 to bcb9c7b Compare November 11, 2026 02:11
@Rajatendu1

Copy link
Copy Markdown
Author

The second-review corrections are now in bcb9c7b, kept in this PR as one commit. I replied to each of the four implementation findings and six nonblocking notes and updated the PR body with the evidence and limits.

The focused run passes 177 tests, including 46 Rating cases. Chrome checks against generated Core/Lab CSS cover all four hover gaps, native activation, RTL fractional fill and touch cancellation. Full CI and the other validation limits remain as stated in the PR body.

The component:Rating record and engineering-owner API, naming, keyboard, wording and colour-role decisions are still open. This correction does not claim design/spec approval.

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

Thanks: all four earlier blocking points (the gap-hover preview, data-star, the read-only onKeyDown/onFocus, the read-only wrappers) and the six smaller notes are fixed at this head.

Approval still waits on a component record: Rating has no component:Rating spec (the action-groups family covers only its touch slide-and-lift), so an engineering owner needs to provide or identify one, either as a record merged on main or by approving an in-PR record with a /approve-spec <full head SHA> comment (the author may do this only if they are an engineering owner). That record settles the controlled radio-group API, the allowClear and getStarLabel names (beside Core's hasClear and ProgressBar's formatValueLabel), the keyboard model, the read-only display and its wording, and the colour roles.

After that, this needs fixing:

  • Miss: when a caller ignores onChange (as the Sizes and States stories do), an arrow key leaves the tab stop on the focused, unchecked star because useListFocus's hasRovingTabIndex and Rating's own tabIndex both write it, so drop hasRovingTabIndex and add a test that Tab re-entry lands on the checked star.

Automated review (maintainer link)

Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.tsx Resolved
@cixzhang
cixzhang marked this pull request as ready for review November 19, 2026 13:46
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 391f94e

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
lab/Rating · Storybook 65.1 kB (new) · 949 B CSS (new) 397 (new) — · ✓ · ✗

Package size: @astryxdesign/cli 5.72 MB packed (−2 B); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

Rating requires label and value, so the swizzle proof needs a sample.
Rating reflects size to themes through themeProps, so it picks the size
style and passes it to StarGlyph. The theming-target guard then finds the
painted size axis in the function that reflects it.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 157dca5

@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 run on this commit yet. The ci:run label is on, but the CI, Lint and CLI Smoke Test runs for this commit are waiting for a maintainer to approve them.

An engineering owner approved Rating's contract for this exact commit, and the two checks that failed on the previous commit now pass here: the theming-target guard (the glyph size now comes from Rating) and the swizzle-proof sample check. Rating's 49 tests, the route-lock check and the official discover-list check also pass.

  • Non-blocking: the description says the pull request changes only Lab, its story, the discover list and the route lock, and that later commits change only forced-colours paint, the paused preview and the tab stop. It now also adds the lab__Rating swizzle-proof sample and moves the glyph size style into Rating, so one added line would keep it exact.
Claims and files checked

Review mode: full; reason: author-not-engowner

Claims:

  • Core's half (the internal touch exports and the two catalog messages) is already on main, and no Core file changes: verified (no packages/core path in the diff; the tests import those exports).
  • The pull request changes only Lab, its story, the discover list and the route lock: true but narrower than the change, which also adds a changeset and one swizzle-proof test sample (samples.mjs:410-411).
  • A controlled whole-star radio group with one tab stop, shared list focus without wrapping, Home/End, Space/Enter and optional clear: verified (Rating.tsx:268-273, :410; tests).
  • Horizontal arrows follow text direction, Down advances and Up retreats: verified (right-to-left and arrow-key tests).
  • Navigation never clears a selected boundary, while a click, Space or Enter can: verified (boundary and explicit-activation tests).
  • Touch chooses only the lifted star, while leaving, cancelling or a second finger chooses nothing. Coarse targets grow toward 44 px, and a mouse stays native: verified (pointer-stream tests).
  • The hover preview is scoped CSS, and an arrow, Home, End, Space or Enter choice pauses it until the pointer moves: verified (Rating.tsx:150-159, :352-353, :362-367; preview tests).
  • Read-only is one named image with an inline-start fractional fill, a label callback that receives fractions, and catalog names: verified (tests; Chromium shows the name and the right-to-left fill).
  • Lab exports Rating, RatingProps and RatingSize. The caller owns the value and the label, the listed props exist, and there is no half-star input: verified (packages/lab/src/index.ts; RatingProps).
  • Only a focus move from navigation selects. Tab, script and pointer focus do not: verified (focus tests).
  • Caller pointer-leave, key, focus, blur and pointer-move handlers still run, read-only included: verified (Rating.tsx:303-306, :341-389; handler tests).
  • One SVG per star with static sizes, and only a fractional read-only star adds a clipped path, mirrored right-to-left: verified (tests; Chromium sizes 16, 24 and 32 px).
  • A hover in a gap keeps the committed rating, with no per-star data attribute and no style-only wrappers: verified (tests; the preview's default arm).
  • Rating alone owns the tab stop. The focused star holds it inside the group, Tab leaves in one press, and Shift+Tab re-enters on the checked star: verified (tab-stop test).
  • Forced colours paint checked stars Highlight, empty ones CanvasText and a disabled rating GrayText, with a browser spec on a touch page and a mouse page: verified (Chromium probe; spec read, not run).
  • 49 Rating tests (39 component, 10 pointer-stream) pass: verified (run on this commit).
  • Lab TypeScript, ESLint, package boundaries, changesets, SYNC, use-client and the i18n catalog pass: verified (run on this commit). Babel, the CSS builds and Prettier were not rerun.
  • Counts, failures and real-Chrome runs stated for earlier commits: they describe earlier commits and were not rechecked.
  • The stills still hold because later commits change only forced-colours paint, the paused preview and the tab stop: the stills hold (the star sizes are unchanged), but later commits also move the size style and add the swizzle sample.
  • Full CI, the Storybook browser workflow, visual regression, other browsers and a screen reader are unverified: accurate (CI waits for a maintainer).
  • The issue's reply welcomed a Lab Rating and offered help with the component record, which is not supplied here: verified (issue reply; no Rating record on main).
  • A maintainer added the doc's anatomy: verified (Rating.doc.mjs usage.anatomy).
  • Changeset: astryx discover lists the experimental Rating from Lab: verified (Lab entry in the official list, which a canary CLI shows; the generator check passes).

Files:

  • .changeset/cli-discover-rating.md: clear
  • apps/storybook/stories/Rating.stories.tsx: clear
  • internal/shadcn-registry/routes.lock.json: clear
  • packages/cli/assets/discover/official-packages.json: clear
  • packages/cli/test/swizzle-proof/samples.mjs: clear
  • packages/lab/src/Rating/Rating.doc.mjs: clear
  • packages/lab/src/Rating/Rating.test.tsx: clear
  • packages/lab/src/Rating/Rating.tsx: clear
  • packages/lab/src/Rating/RatingTracking.test.tsx: clear
  • packages/lab/src/Rating/__tests__/RatingForcedColors.interaction.browser.spec.ts: 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)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 3cf65bf

@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 run on this commit yet. The ci:run label is on, but the CI, Lint and CLI Smoke Test runs for this commit are waiting for a maintainer to approve them.

An engineering owner approved Rating's contract for this exact commit, which only merges main and leaves Rating's own code unchanged. Rating's 49 tests, the route-lock check, the official discover-list check and the new Rating swizzle sample pass here.

  • Heads-up: the swizzle-sample guard currently fails on main for lab__MediaPlayer (added with the media players, no sample), so CI's node tests may show that failure on this commit too; it does not come from Rating.
  • Non-blocking: the description says the pull request changes only Lab, its story, the discover list and the route lock, and that later commits change only forced-colours paint, the paused preview and the tab stop; it also adds the lab__Rating swizzle-proof sample and moves the glyph size style into Rating, so one added clause would keep it exact.
  • Non-blocking: an unrated star's outline uses the same border colour as Core's radio and checkbox edges, about 1.5:1 on white in the neutral theme; when the repository's 3:1 control-edge colour lands, Rating's outline should move with them.
Claims and files checked

Review mode: full; reason: author-not-engowner

Claims:

  • Rating's Core half (the internal touch exports and the two catalog messages) is already on main, and no Core file changes: verified (no Core path in the diff; the exports and messages exist on main).
  • The pull request changes only Lab, its story, the discover list and the route lock: narrower than the change, which also adds a changeset and a swizzle-proof sample (samples.mjs:422-423).
  • A controlled whole-star radio group with one tab stop, shared list focus without wrapping, Home/End, Space/Enter and optional clear: verified (Rating.tsx:268-273, :410; tests; Chromium).
  • Horizontal arrows follow text direction; Down advances and Up retreats: verified (right-to-left and arrow-key tests).
  • Navigation never clears a selected boundary, while a click, Space or Enter can: verified (boundary and explicit-activation tests).
  • Touch chooses only the lifted star; leaving, cancelling or a second finger chooses nothing; coarse targets grow toward 44 px; a mouse stays native: verified (pointer-stream tests; a Chromium finger slide from 1 to 4 chooses 4).
  • The hover preview is scoped CSS, and an arrow, Home, End, Space or Enter choice pauses it until the pointer moves: verified (Rating.tsx:150-159, :352-353, :363-366; preview tests).
  • Read-only is one named image with an inline-start fractional fill, a label callback that receives fractions and catalog names: verified (tests; Chromium name and left-to-right and right-to-left clips).
  • Lab exports Rating, RatingProps and RatingSize; the caller owns the value and the label; the listed props exist; there is no half-star input: verified (packages/lab/src/index.ts; RatingProps).
  • Only a focus move from navigation selects; Tab, script and pointer focus do not: verified (focus tests).
  • Caller pointer-leave, key, focus, blur and pointer-move handlers still run, read-only included: verified (Rating.tsx:303-306, :341-389; pointer-leave, key and focus tests).
  • One SVG per star with static sizes; only a fractional read-only star adds a clipped path, mirrored right-to-left: verified (tests; Chromium sizes 16, 24 and 32 px).
  • A hover in a gap keeps the committed rating; no per-star data attribute; no style-only wrappers: verified (Chromium gap probe; tests).
  • Rating owns the tab stop: the focused star holds it inside the group, one Tab leaves and Shift+Tab re-enters on the checked star: verified (tab-stop test).
  • Forced colours paint checked stars Highlight, empty ones CanvasText and a disabled rating GrayText, with a browser spec on a touch page and a mouse page: verified (Chromium probe; spec read, not run).
  • 49 Rating tests (39 component, 10 pointer-stream) pass: verified (run on this commit).
  • Lab TypeScript, ESLint, package boundaries, changesets, SYNC, use-client and the catalog check pass: verified; Prettier flags only the generated route lock, as on main, and Lab's doc typecheck needs a Lab build (its errors are in other components' blocks).
  • Counts, failures and real-Chrome runs stated for earlier commits: they describe earlier commits and were not rechecked.
  • The stills still hold because later commits change only forced-colours paint, the paused preview and the tab stop: the stills hold (star sizes unchanged), but later commits also move the glyph size style and add the swizzle sample.
  • Full CI, the Storybook browser workflow, visual regression, other browsers and a screen reader are unverified: accurate (CI waits for a maintainer).
  • The issue reply welcomed a Lab Rating and offered help with the component record, which is not supplied here: verified (issue reply; no Rating record on main).
  • A maintainer added the doc's anatomy: present (Rating.doc.mjs usage.anatomy).
  • Changeset: astryx discover lists the experimental Rating from Lab: verified (Lab entry in the official list; the generator check passes).

Files:

  • .changeset/cli-discover-rating.md: clear
  • apps/storybook/stories/Rating.stories.tsx: clear
  • internal/shadcn-registry/routes.lock.json: clear
  • packages/cli/assets/discover/official-packages.json: clear
  • packages/cli/test/swizzle-proof/samples.mjs: clear
  • packages/lab/src/Rating/Rating.doc.mjs: clear
  • packages/lab/src/Rating/Rating.test.tsx: clear
  • packages/lab/src/Rating/Rating.tsx: clear
  • packages/lab/src/Rating/RatingTracking.test.tsx: clear
  • packages/lab/src/Rating/__tests__/RatingForcedColors.interaction.browser.spec.ts: 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)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 391f94e

@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 run on this commit yet. The ci:run label is on, but the CI, Lint and CLI Smoke Test runs for this commit are waiting for a maintainer to approve them.

An engineering owner approved Rating's contract for this exact commit, which only merges main and leaves Rating's own code unchanged. Rating's 49 tests, all five swizzle-sample tests, the route-lock check, the official discover-list check and Lab's typecheck pass here.

  • Non-blocking: the description says the pull request changes only Lab, its story, the discover list and the route lock, that later commits change only forced-colours paint, the paused preview and the tab stop, and that the land path is Lab-only; it also adds a CLI changeset and the lab__Rating swizzle-proof sample and moves the glyph size style into Rating, so one added clause each would keep it exact.
  • Non-blocking: an unrated star's outline uses the same border colour as Core's radio and checkbox edges, about 1.5:1 on white in the neutral theme; when the repository's 3:1 control-edge colour lands, Rating's outline should move with them.
Claims and files checked

Review mode: full; reason: author-not-engowner

Claims:

  • Rating's Core half (the internal touch exports and the two catalog messages) is already on main, and no Core file changes: verified (no Core path in the diff; internal/touch.ts:133-136 and the two catalog messages exist).
  • The pull request changes only Lab, its story, the discover list and the route lock: narrower than the change, which also adds a changeset and a swizzle-proof sample (samples.mjs:422-423).
  • A controlled whole-star radio group with one tab stop, shared list focus without wrapping, Home/End, Space/Enter and optional clear: verified (Rating.tsx:268-273, :410; tests; Chromium).
  • Horizontal arrows follow text direction; Down advances and Up retreats: verified (right-to-left and arrow-key tests).
  • Navigation never clears a selected boundary, while a click, Space or Enter can: verified (boundary and explicit-activation tests).
  • Touch chooses only the lifted star; leaving, cancelling or a second finger chooses nothing; coarse targets grow toward 44 px; a mouse stays native: verified (10 pointer-stream tests; a Chromium finger slide from 1 to 4 chooses 4).
  • The hover preview is scoped CSS, and an arrow, Home, End, Space or Enter choice pauses it until the pointer moves: verified (Rating.tsx:104-117, :150-159, :353, :365; preview tests).
  • Read-only is one named image with an inline-start fractional fill, a label callback that receives fractions and catalog names: verified (tests; Chromium name and left-to-right and right-to-left clips).
  • The issue reply welcomed a Lab Rating and offered help with the component record, which is not supplied here: verified (issue reply; no Rating record on main).
  • Lab exports Rating, RatingProps and RatingSize; the caller owns the value and the label; the listed props exist; there is no half-star input: verified (packages/lab/src/index.ts:125-126; RatingProps).
  • Only a focus move from navigation selects; Tab, script and pointer focus do not: verified (focus tests).
  • Caller pointer-leave, key, focus, blur and pointer-move handlers still run, read-only included: verified (Rating.tsx:303-306, :341-389; pointer-leave, key and focus tests).
  • One SVG per star with static sizes; only a fractional read-only star adds a clipped path, mirrored right-to-left: verified (tests; Chromium sizes 16, 24 and 32 px).
  • A hover in a gap keeps the committed rating; no per-star data attribute; no style-only wrappers: verified (sibling hover rules at Rating.tsx:104-117 leave the committed paint when no star is hovered; tests).
  • Rating owns the tab stop: the focused star holds it inside the group, one Tab leaves and Shift+Tab re-enters on the checked star: verified (tab-stop test).
  • Forced colours paint checked stars Highlight, empty ones CanvasText and a disabled rating GrayText, with a browser spec on a touch page and a mouse page: verified (Chromium probe against the page's system colours; spec read, not run).
  • 49 Rating tests (39 component, 10 pointer-stream) pass: verified (run on this commit).
  • Lab TypeScript, ESLint, package boundaries, changesets, SYNC, use-client and the catalog check pass: verified; Prettier and Lab's doc typecheck were not rerun.
  • Counts, failures and real-Chrome runs stated for earlier commits: they describe earlier commits and were not rechecked.
  • The stills still hold because later commits change only forced-colours paint, the paused preview and the tab stop: the stills hold (star sizes unchanged), but later commits also move the glyph size style and add the swizzle sample.
  • Full CI, the Storybook browser workflow, visual regression, other browsers and a screen reader are unverified: accurate (CI waits for a maintainer).
  • A maintainer added the doc's anatomy: present (Rating.doc.mjs usage.anatomy).
  • The land path is Lab-only: inaccurate, since the pull request also changes CLI and Storybook files; non-blocking.
  • Changeset: astryx discover lists the experimental Rating from Lab: verified (Lab entry in the official list; the generator check passes).

Files:

  • .changeset/cli-discover-rating.md: clear
  • apps/storybook/stories/Rating.stories.tsx: clear
  • internal/shadcn-registry/routes.lock.json: clear
  • packages/cli/assets/discover/official-packages.json: clear
  • packages/cli/test/swizzle-proof/samples.mjs: clear
  • packages/lab/src/Rating/Rating.doc.mjs: clear
  • packages/lab/src/Rating/Rating.test.tsx: clear
  • packages/lab/src/Rating/Rating.tsx: clear
  • packages/lab/src/Rating/RatingTracking.test.tsx: clear
  • packages/lab/src/Rating/__tests__/RatingForcedColors.interaction.browser.spec.ts: 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)

@cixzhang
cixzhang marked this pull request as draft November 19, 2026 23:08
@cixzhang
cixzhang marked this pull request as ready for review November 19, 2026 23:08
cixzhang
cixzhang previously approved these changes Nov 19, 2026
@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Nov 19, 2026
@cixzhang
cixzhang dismissed their stale review November 19, 2026 23:38

Approval withdrawn pending description corrections; will re-approve after re-review.

@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 statements in the description are wrong at this commit; Rating's code needs no change.

An engineering owner approved Rating's contract for this exact commit, and CI, Lint and the CLI smoke test pass here with no failing check.

  • Miss: the Component record section says the separate draft record states the contract this branch implements, but that record (#12815) still says forced colours paint filled stars Highlight and empty stars CanvasText in every state, keeps the tab stop on the checked or first star, and ends the hover preview only when the pointer leaves, while this branch paints every star of a disabled rating GrayText, gives the tab stop to the focused star while focus is inside the group, and also ends the preview on a choice key, so say the record still needs those three updates or update it first.
  • The Validation limits section says full CI is unverified and the repository workflows still need maintainer approval, but CI, Lint and CLI Smoke Test have run and passed at this commit, so keep only what is still unverified: a real screen reader, the Lab readiness audit, and visual regression, which has no stable Lab stories.

Non-blocking: adopting the 3:1 control edge once #11658 lands is a new commit that gets its own review, and the draft record's outline colour needs the same change.

Claims and files checked

Review mode: same-head; reason: none

Claims:

  • Rating's Core half (the internal touch exports and two catalog messages) is already on main, and no Core file changes: verified (no Core path in the diff; Core's internal touch entry lines 133-136; locales/en.json:2730, :2734).
  • The pull request changes Lab, its story, the discover list and its changeset, the route-lock entry and a swizzle-proof sample: verified (the 13 changed files).
  • A controlled whole-star radio group with one tab stop, shared list focus without wrapping, Home/End, Space/Enter and optional clear: verified (Rating.tsx:268-273, :410; tests).
  • Horizontal arrows follow text direction; Down advances and Up retreats: verified (right-to-left and arrow-key tests; the shared list focus hook).
  • Navigation never clears a selected boundary, while a click, Space or Enter can: verified (boundary and explicit-activation tests).
  • Touch chooses only the lifted star; leaving, cancelling or a second finger chooses nothing; coarse targets grow toward 44 px; a mouse stays native: verified (10 pointer-stream tests).
  • The hover preview is scoped CSS, and an arrow, Home, End, Space or Enter choice pauses it until the pointer moves: verified (Rating.tsx:100-117, :150-159, :352-354; preview tests).
  • Read-only is one named image with an inline-start fractional fill, a label callback that receives fractions, and catalog names: verified (tests; Rating.tsx:140-145).
  • The issue reply welcomed a Lab Rating and offered help with the component record: verified (issue reply).
  • Lab exports Rating, RatingProps and RatingSize; the caller owns the value and label; the listed props exist; no half-star input: verified (packages/lab/src/index.ts:125-126; RatingProps; whole-star rounding in clampRating).
  • Rating picks the glyph's size style itself and reflects size to themes: verified (Rating.tsx:322, :428; the theme props call).
  • Only a navigation focus move selects; Tab, script and pointer focus do not: verified (focus tests).
  • Caller pointer-leave, key, focus, blur and pointer-move handlers still run, read-only included: verified (Rating.tsx:303-306, :341-389; tests).
  • One SVG per star with static sizes; only a fractional read-only star adds a clipped path, mirrored right-to-left: verified (tests; Rating.tsx:140-145).
  • A hover in a gap keeps the committed rating; no per-star data attribute; no style-only wrappers: verified (sibling hover rules; tests).
  • Rating owns the tab stop; the focused star holds it inside the group; one Tab leaves and Shift+Tab returns to the checked star: verified (Rating.tsx:368-374, :410; Rating.test.tsx:47-73).
  • Forced colours paint checked stars Highlight, empty ones CanvasText and a disabled rating GrayText, with a browser spec on a touch page and a mouse page: verified (Rating.tsx:67-71, :87-98, :130-139; spec lines 66-71).
  • 49 Rating tests (39 component, 10 pointer-stream) pass: verified (count; CI's UI test legs pass at this commit).
  • Lint, typecheck, package boundaries, changesets, SYNC, use-client and the catalog check pass: verified (CI's lint and typecheck pass at this commit).
  • Failures and real-Chrome runs stated for earlier commits: they describe earlier commits and were not rechecked.
  • The stills still hold because later commits change only forced-colours paint, the paused preview and the tab stop: verified in substance (the size-style change renders the same 16, 24 and 32 px stars; the other later commits are tests).
  • The per-state stills index: hosted outside this repository and not read.
  • Full CI is unverified and the repository workflows still need maintainer approval: false (CI, Lint and CLI Smoke Test pass at this commit, no failing check).
  • The unrated outline uses the colour Core's checkbox and radio edges use, about 1.5:1 on white, below 3:1: verified (Rating.tsx:88-90; Core's checkbox and radio indicators).
  • The pull request waits for the 3:1 control edge (#11658) and adopts it in a later push: a plan; #11658 is an open draft and this commit keeps the current outline.
  • The separate draft record states the contract this branch implements: false (its forced-colours, tab-stop and preview rules differ).
  • A maintainer added the doc's anatomy: verified (a maintainer's commit; Rating.doc.mjs usage.anatomy).
  • The land path is mixed and needs no Lab API owner decision: consistent with the repository's checklist, which asks none for unpublished Lab API; an engineering owner approved the contract anyway.
  • Changeset: astryx discover lists the experimental Rating from Lab: verified (the official list's Lab entry; the generator check passes).

Files:

  • .changeset/cli-discover-rating.md: clear
  • apps/storybook/stories/Rating.stories.tsx: clear
  • internal/shadcn-registry/routes.lock.json: clear
  • packages/cli/assets/discover/official-packages.json: clear
  • packages/cli/test/swizzle-proof/samples.mjs: clear
  • packages/lab/src/Rating/Rating.doc.mjs: clear
  • packages/lab/src/Rating/Rating.test.tsx: clear
  • packages/lab/src/Rating/Rating.tsx: clear
  • packages/lab/src/Rating/RatingTracking.test.tsx: clear
  • packages/lab/src/Rating/__tests__/RatingForcedColors.interaction.browser.spec.ts: 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)

@cixzhang
cixzhang marked this pull request as draft November 21, 2026 05:07
@github-actions github-actions Bot added the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Nov 21, 2026
@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 — 391f94e3 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 A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) 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. community Authored by a community contributor (not on the eng/design team) lane:3 Astryx fix-loop lane 3 owns this needs:code-review High-risk change (new package/component/API) — needs human code review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants