Skip to content

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

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

Rajatendu1 wants to merge 15 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 only Lab, its story, the CLI's discover list, and the generated shadcn route-lock entry.

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 and the generated CLI discover and route-lock entries.

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.

Full CI, whole-repository tests, built Storybook/browser specs, visual regression, other browsers, a real screen reader and Lab readiness audit remain unverified. Repository workflows still need maintainer approval. No maintainer design/spec approval is claimed.

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.

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 Lab-only pull request does not wait on its owner approval. The record states the contract this branch implements. A maintainer added the doc's usage.anatomy here.

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. Lab-only: 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 Building Building Preview Nov 19, 2026 5:13pm 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
🔄 In progress (for maintainers only) Nov 19, 2026, 5:13 PM 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 cla@meta.com. 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
…view

While focus is inside the group, the focused star holds the tab stop, and
a blur out of the group hands it back to the checked star, so a caller
that ignores onChange no longer makes Tab stop on the checked star first.
A key choice ends the hover preview until the pointer moves, so the
preview never paints a count other than the value. Caller onBlur and
onPointerMove handlers still run, read-only included.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec c48db6d

@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 carrying this through: the Rating contract is approved by an engineering owner at this head, and the earlier hover-preview and Tab-hop notes are fixed. Two things still need changing before this can be approved.

Blocking

  • A disabled Rating still paints its filled stars in Highlight under forced colours, because filled's own top-level forced-colours rule (Rating.tsx:94) outranks the new arm in filledDisabled, so please write the forced-colours arms of filled and empty in the property form (color: {default: …, '@media (forced-colors: active)': 'Highlight'}) so that filledDisabled replaces them.
  • The description no longer matches the code: "Latest correction" says a disabled Rating now paints GrayText in forced colours, "Third-review corrections" says the checked star stays the only tab stop when a caller ignores onChange (the focused star now holds it while focus is inside), "Evidence" counts 47 tests where there are 48, the hover bullet omits the new pause state, and the opening note leaves out the generated route-lock entry, so please update those sentences and describe the Tab and hover-pause change.

Non-blocking

  • Space and Enter do not pause the hover preview the way the arrow keys now do, so with the mouse resting on another star the preview keeps painting that star's count after a key choice.

CI has not run on this head yet; a maintainer adds the ci:run label so it runs.

Claims and files checked

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

  • Claim: the Core half landed separately and the base branch is merged in: verified.
  • Claim: the pull request changes only Lab, its story and the CLI discover list: false (the route-lock entry also changes).
  • Claim: controlled whole-star radio group with one tab stop, shared list navigation without wrapping, Home/End, Space/Enter and optional clear: verified.
  • Claim: horizontal arrows follow text direction, Down advances and Up retreats, and navigation never clears a selected boundary: verified.
  • Claim: touch selects only the lifted star, leaving, cancelling or a second finger selects nothing, coarse targets grow toward 44 px, mouse presses stay native: verified.
  • Claim: the hover preview uses scoped CSS, not React state: partly stale (a state now pauses it).
  • Claim: the read-only display is one named image with inline-start fractional fill and catalog-backed names: verified.
  • Claim: new Lab exports and props, no half-star input, no Core file changed, story and generated discover and route-lock entries added: verified.
  • Claims from the first and second review rounds (navigation-only selection, boundary no-op, caller handlers, one SVG per star, gap hover, no internal data attribute, native activation, read-only handler forwarding, no wrapper spans): verified.
  • Claim: when a caller ignores onChange the checked star stays the only tab stop, and the regression verifies an unchanged tab stop: false.
  • Claim: 47 Rating tests (37 component, 10 pointer-stream): false (48: 38 and 10).
  • Claim: Lab typecheck, builds, lint, formatting, boundaries, changesets, SYNC, use-client and catalog checks pass; full CI not yet run: verified.
  • Claim: a disabled Rating now paints GrayText in forced colours: false for filled stars.
  • Claim: the draft component record lives in its own pull request and a maintainer added the doc's anatomy: verified.
  • Changeset: astryx discover lists the experimental Rating from Lab: verified.
  • Files: .changeset/cli-discover-rating.md, apps/storybook/stories/Rating.stories.tsx, internal/shadcn-registry/routes.lock.json, packages/cli/assets/discover/official-packages.json, Rating.doc.mjs, Rating.test.tsx, RatingTracking.test.tsx, Rating/index.ts, rating.stylex.ts, packages/lab/src/index.ts: clear.
  • File: Rating.tsx: the forced-colours finding above, and the non-blocking Space/Enter note.

Automated review (maintainer link)

Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.tsx Resolved
The forced-colours colours of the empty and filled stars are now arms of
their color property, so the disabled style's arm replaces them. Before,
the top-level media rule outranked it and filled stars stayed Highlight.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 183554d

The interactive star's colour now has its own forced-colours arm:
Highlight for a checked star, CanvasText for the others. Without it,
empty stars took the emphasized border colour, which is not a system
colour and is nearly invisible in a high-contrast theme.
A Chromium forced-colors trace of the States story: a checked star is
Highlight, an empty star CanvasText, and a disabled rating's stars
GrayText.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 405db39

@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 forced-colours fixes: a disabled Rating now paints every star in GrayText, an enabled one keeps Highlight and CanvasText, and an engineering owner approved the Rating contract at this head. Two things still need changing before this can be approved.

Blocking

  • A Space or Enter choice does not pause the hover preview, because only the arrow keys, Home and End reach setPreviewsHover(false) in Rating.tsx, so with the mouse resting on star 4, Space on star 1 sets the rating to 1 while four stars stay filled; this contradicts the description's "a key choice pauses the hover preview" and the comment above previewsHover, so please pause the preview for Space and Enter too (with a test), or narrow both texts to arrow, Home and End choices.
  • The description's third-review bullet still says the regression "verifies the unchanged checked/tab-stop state", while the test now asserts that the focused star holds the tab stop while focus is inside (Rating.test.tsx:66), so please reword that bullet.

Non-blocking

  • The forced-colours arms of --rating-color in interactiveStar and interactiveStarStill no longer reach any paint, because interactivePath's forced arm reads --rating-selected-color directly.

CI has not run on this head yet; a maintainer adds the ci:run label so it runs.

Claims and files checked

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

  • Claim: the Core half (touch re-exports and two catalog messages) landed separately and the base branch is merged in: verified.
  • Claim: the pull request changes only Lab, its story, the CLI discover list and the generated route-lock entry: verified.
  • Claim: controlled whole-star radio group with one tab stop, shared list navigation without wrapping, Home/End, Space/Enter and optional clear: verified.
  • Claim: horizontal arrows follow text direction, Down advances and Up retreats, and navigation never clears a selected boundary: verified.
  • Claim: touch selects only the lifted star, leaving, cancelling or a second finger selects nothing, coarse targets grow toward 44 px, mouse presses stay native: verified.
  • Claim: the hover preview is scoped CSS, and an arrow, Home or End choice pauses it so it paints the value: verified.
  • Claim: the read-only display is one named image with inline-start fractional fill and catalog-backed names: verified.
  • Claim: the linked issue got a positive Lab-only owner response and the component record is not supplied here: verified.
  • Claim: new Lab exports and props, no half-star input, no Core file changed, story and generated entries added: verified.
  • Claims from the first and second review rounds (navigation-only selection, boundary no-op, caller handlers, one SVG per star, gap hover, no internal data attribute, native activation, read-only handler forwarding, no wrapper spans): verified.
  • Claim: Rating owns its value-derived tab stop, the focused star holds it while focus is inside, and Tab re-entry returns to the checked star: verified.
  • Claim: the third-round regression verifies an unchanged tab stop: false (the test asserts the stop moves to the focused star while focus is inside).
  • Claim: 48 Rating tests (38 component, 10 pointer-stream) pass: verified.
  • Claims about earlier heads (earlier test counts and reproduction failures, temporary-page browser checks): historical, not re-run.
  • Claim: Lab typecheck, builds, lint, formatting, boundaries, changesets, SYNC, use-client and catalog checks pass; full CI not yet run: verified.
  • Claim: under forced colours a checked star is Highlight, an empty star CanvasText and every disabled star GrayText, and the new browser spec asserts it: verified.
  • Claim: a key choice pauses the hover preview until the pointer moves: false for Space and Enter.
  • Claim: caller blur and pointer-move handlers still run, read-only included: verified.
  • Claim: later commits change only forced-colours paint, the paused preview and the tab stop, so the earlier stills hold: verified.
  • Claim: real-Chrome stills cover Core and Neutral, light and dark, desktop and touch widths: not checked (hosted outside this repository).
  • Claim: the draft component record lives in its own pull request and the doc's anatomy was added: verified.
  • Changeset: astryx discover lists the experimental Rating from Lab: verified.
  • Files: .changeset/cli-discover-rating.md, apps/storybook/stories/Rating.stories.tsx, internal/shadcn-registry/routes.lock.json, packages/cli/assets/discover/official-packages.json, Rating.doc.mjs, RatingTracking.test.tsx, RatingForcedColors.interaction.browser.spec.ts, Rating/index.ts, rating.stylex.ts, packages/lab/src/index.ts: clear.
  • File: Rating.test.tsx: clear (the stale description bullet concerns it).
  • File: Rating.tsx: the Space/Enter finding above, and the non-blocking forced-colours note.

Automated review (maintainer link)

Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Comment thread packages/lab/src/Rating/Rating.tsx Resolved
Hover-guarded rules apply only under a hover-capable pointer, so the phone
page alone cannot see a regression there. The proof now runs on the touch
page and on a mouse page.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 71650ab

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

This still needs changes before it can be approved: an engineering owner approved the Rating contract at this head, but the two points from the last review are still open.

Blocking

  • A Space or Enter choice does not pause the hover preview, because only the arrow keys, Home and End reach setPreviewsHover(false) in Rating.tsx, so with the mouse resting on star 4, Space or Enter on star 1 sets the rating to 1 while four stars stay filled; this contradicts the description's "a key choice pauses the hover preview" and the comment above previewsHover, so please pause the preview for Space and Enter too (with a test), or narrow both texts to arrow, Home and End choices.
  • The description's third-review bullet still says the regression "verifies the unchanged checked/tab-stop state", while the test asserts that the focused star holds the tab stop while focus is inside (Rating.test.tsx:66), so please reword that bullet.

Non-blocking

  • The forced-colours arms of --rating-color in interactiveStar and interactiveStarStill reach no paint, because interactivePath's forced arm reads --rating-selected-color directly.

CI has not run on this head yet; a maintainer adds the ci:run label so it runs.

Claims and files checked

Review mode: same-head; reason: none

  • Claim: the Core half (touch re-exports and two catalog messages) landed separately and the base branch is merged in: verified.
  • Claim: the pull request changes only Lab, its story, the CLI discover list and the generated route-lock entry: verified.
  • Claim: controlled whole-star radio group with one tab stop, shared list navigation without wrapping, Home/End, Space/Enter and optional clear: verified.
  • Claim: horizontal arrows follow text direction, Down advances and Up retreats, and navigation never clears a selected boundary while explicit activation can: verified.
  • Claim: touch selects only the lifted star; leaving, cancelling or a second finger selects nothing; coarse targets grow toward 44 px; mouse presses stay native: verified.
  • Claim: the hover preview is scoped CSS, and an arrow, Home or End choice pauses it until the pointer moves: verified.
  • Claim: a key choice pauses the hover preview until the pointer moves: false for Space and Enter.
  • Claim: the read-only display is one named image with inline-start fractional fill, a label callback that receives fractions, and catalog-backed names: verified.
  • Claim: the linked issue got a positive Lab-only owner response, the earlier core proposal is separate, and the component record is not supplied here: verified.
  • Claim: new Lab exports and props, no half-star input, no Core file changed, story and generated entries added: verified.
  • Claims from the first and second review rounds (navigation-only selection, boundary no-op, caller handlers, one SVG per star, gap hover, no internal data attribute, native activation, read-only handler forwarding, no wrapper spans): verified.
  • Claim: Rating owns its value-derived tab stop, the focused star holds it while focus is inside, and Tab re-entry returns to the checked star: verified.
  • Claim: the third-round regression verifies an unchanged tab stop: false (the test asserts the stop moves to the focused star while focus is inside).
  • Claim: 48 Rating tests (38 component, 10 pointer-stream) pass: verified.
  • Claims about earlier heads (earlier test counts, reproduction failures, temporary-page browser checks): historical, not re-run.
  • Claim: Lab typecheck, builds, lint, formatting, boundaries, changesets, SYNC, use-client, catalog, no-dev-JSX and fully-specified checks pass, and full CI has not run: verified.
  • Claim: under forced colours a checked star is Highlight, an empty star CanvasText and every disabled star GrayText, each set as an arm of the colour: verified.
  • Claim: the browser spec asserts all three on a touch page and on a hover-capable mouse page, and the mouse-page case fails on the earlier head that lost CanvasText: verified.
  • Claim: caller blur and pointer-move handlers still run, read-only included: verified.
  • Claim: later commits change only forced-colours paint, the paused preview and the tab stop, so the earlier stills hold: verified.
  • Claim: real-browser stills cover Core and Neutral, light and dark, desktop and touch widths: not checked (hosted outside this repository).
  • Claim: the draft component record lives in its own pull request and the doc's anatomy was added: verified.
  • Changeset: astryx discover lists the experimental Rating from Lab: verified.
  • Files: the changeset, the story, the route lock, the discover list, Rating.doc.mjs, RatingTracking.test.tsx, the forced-colours browser spec, Rating/index.ts, rating.stylex.ts and packages/lab/src/index.ts: clear.
  • File: Rating.test.tsx: clear (the stale description bullet concerns it).
  • File: Rating.tsx: the Space/Enter finding above, and the non-blocking forced-colours note.

Automated review (maintainer link)

A choice by Space or Enter now ends the hover preview until the pointer
moves, as an arrow key does. The unused forced-colours arms of
--rating-color are gone; the star path reads the selected colour
directly there.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 0fdb1b5

@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 head yet, so a maintainer needs to add the ci:run label for it to run.

An engineering owner approved Rating's contract at this exact head, and the last issue from the previous review is fixed: Space and Enter now pause the hover preview, a new test covers it, and in Chromium the preview stays off until the pointer moves again. Thanks for carrying this through every round.

Claims and files checked

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

Claims:

  • Core's half (internal touch exports and the two catalog messages) is already on main, and this pull request changes only Lab, its story, the discover list and the route lock, plus a changeset: verified (base internal touch entry and English catalog; the 12-file diff).
  • Controlled whole-star radio group with one tab stop, shared list focus without wrapping, Home/End, Space/Enter and optional clear: verified (Rating.tsx:266-273, :336-416; tests).
  • Horizontal arrows follow text direction; Down advances and Up retreats: verified (right-to-left test; Chromium right-to-left run).
  • Navigation never clears a selected boundary; an explicit click, Space or Enter can: verified (boundary and clear tests).
  • Touch chooses the lifted star; leaving, cancelling or a second finger chooses nothing; coarse targets grow toward 44 px; a mouse stays native: verified (RatingTracking.test.tsx; Chromium phone profile).
  • Hover preview is scoped CSS; an arrow, Home, End, Space or Enter choice pauses it until the pointer moves: verified (Rating.tsx:150-159, :352-353, :362-366; Rating.test.tsx:75-89; Chromium).
  • Hovering a gap between stars keeps the committed rating: verified (Chromium, all four gaps).
  • Read-only is one named image with an inline-start fractional fill and a label callback that receives fractions, and names come from catalog messages: verified (tests; Chromium clip in both directions).
  • Caller pointer-leave, key, focus, blur and pointer-move handlers still run, read-only included: verified (tests; Rating.tsx:303-306, :362-370).
  • Rating owns the tab stop: the focused star holds it inside the group and Tab re-enters on the checked star, as the regression test describes: verified (Rating.tsx:410; Rating.test.tsx:47-73).
  • Forced colours paint checked stars Highlight, empty stars CanvasText and a disabled rating GrayText, with a browser spec on a touch and a mouse page: verified (Chromium probe; spec read, not run here).
  • 49 Rating tests (39 component, 10 pointer-stream) pass: verified (sandboxed run).
  • ESLint, package boundaries, changesets, SYNC, use-client and i18n catalog checks and Lab TypeScript pass: verified (sandboxed run).
  • Counts and failures reported for earlier heads: describe earlier heads; not rechecked.
  • Full CI, the Storybook browser workflow, visual regression, other browsers and a screen reader are unverified: accurate (CI waits for a maintainer).
  • Commits after the stills' head change only forced-colours paint, the paused preview and the tab stop: verified (commit history).
  • Changeset: astryx discover lists the experimental Rating from Lab: verified (Lab entry in the official list; generator check current).

Files (each clear):

  • .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/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 added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 19, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 45bcb74

@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, so a maintainer needs to add the ci:run label for it to run.

An engineering owner approved Rating's contract for this exact commit, and the merge of main leaves Rating working: its tests pass on the merged tree and both generated entries regenerate exactly.

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 this pull request changes only Lab, its story, the discover list and the route lock, plus a changeset: verified (the 12-file diff; main history).
  • 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; tests; Chromium keyboard capture).
  • Horizontal arrows follow text direction, Down advances and Up retreats: verified (right-to-left and key tests).
  • Navigation never clears a selected boundary, while a click, Space or Enter can: verified (boundary and clear tests).
  • Touch chooses the lifted star, leaving, cancelling or a second finger chooses nothing, coarse targets grow toward 44 px and a mouse stays native: verified (pointer-stream tests; Chromium finger slide).
  • The hover preview is scoped CSS, and an arrow, Home, End, Space or Enter choice pauses it until the pointer moves: verified (Rating.tsx; 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 names and right-to-left clip).
  • Caller pointer-leave, key, focus, blur and pointer-move handlers still run, read-only included: verified (Rating.tsx; handler tests).
  • The focused star holds the tab stop inside the group, and Tab re-enters on the checked star: verified (tab-stop test; Chromium keyboard capture).
  • Forced colours paint checked stars Highlight, empty ones CanvasText and a disabled rating GrayText, with a browser spec on a touch and a mouse page: verified (Chromium probe; spec read, not run).
  • 49 Rating tests (39 component, 10 pointer-stream) pass: verified (sandboxed run with main merged in).
  • ESLint, SYNC, changesets, use-client, i18n catalog and package-boundary checks pass: verified (sandboxed run).
  • Counts and failures stated for earlier commits: they describe earlier commits and were not rechecked.
  • 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 thread; no record on main).
  • Changeset: astryx discover lists the experimental Rating from Lab: verified (Lab entry in the official list; generator check current).

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/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 13:46
@cixzhang
cixzhang marked this pull request as ready for review November 19, 2026 13:46
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 45bcb74

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC
lab/Rating · Storybook 65.1 kB (new) · 949 B CSS (new) 397 (new)

Package size: @astryxdesign/cli 5.59 MB packed (+7 B); no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.

Current run: CI concluded failure; parts of this report may be missing.


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

This branch was successfully deployed

1 active deployment
Preview — 157dca58 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) CLA Signed This label is managed by the Meta Open Source bot. 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants