Skip to content

fix(segmented-control): forward data-testid to the DOM#3852

Merged
cixzhang merged 1 commit into
facebook:mainfrom
let-sunny:fix/segmentedcontrol-data-testid
Jul 12, 2026
Merged

fix(segmented-control): forward data-testid to the DOM#3852
cixzhang merged 1 commit into
facebook:mainfrom
let-sunny:fix/segmentedcontrol-data-testid

Conversation

@let-sunny

@let-sunny let-sunny commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

SegmentedControl and SegmentedControlItem accept BaseProps (so data-testid type-checks) but neither captures ...rest, so data-testid and other pass-through attributes are silently dropped and never reach the DOM — the same defect fixed for CheckboxInput in #3738.

Change

  • SegmentedControl.tsx: spread ...rest onto the radiogroup <div>, before its own role/aria-*.
  • SegmentedControlItem.tsx: spread ...rest onto the radio <button>, before its own role/aria-*.

Test plan

  • 3 new tests: data-testid reaches the radiogroup and each item button, and a consumer-supplied role cannot override the computed one. Reverting the source fails all three.
  • pnpm --filter @astryxdesign/core typecheck and the SegmentedControl suite (34 tests) pass; @astryxdesign/core patch changeset added.

@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 12, 2026 1:08am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 12, 2026
@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 labels Jul 12, 2026
@let-sunny
let-sunny marked this pull request as draft July 12, 2026 01:03
SegmentedControl and SegmentedControlItem declared BaseProps but never captured
...rest or spread it onto their rendered elements, so data-testid and other
pass-through attributes were silently dropped. Capture ...rest and spread it
onto the radiogroup div / radio button before their own role/aria-* (the same
rest-spread fix applied to CheckboxInput in facebook#3738).
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.6KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | View full report

@let-sunny
let-sunny marked this pull request as ready for review July 12, 2026 01:23
@cixzhang

Copy link
Copy Markdown
Contributor

Thanks we should update our component auditor to catch these.

@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Jul 12, 2026
cixzhang added a commit that referenced this pull request Jul 12, 2026
…3853)

* ci(review): auto-clear the gate after approvals on fork PRs

The review-signal clear job runs on pull_request_review, but for fork PRs that event's token is read-only — it 403s removing labels / setting the check, so a fork approval never cleared the gate (e.g. #3852 stayed blocked after a code-owner approved).

New review-clear workflow runs on workflow_run after Review signal completes for a review submission. From the base repo (write token, works for forks) it resolves the PR from the run head SHA and re-dispatches the review-signal flag logic, which reads the approval and clears the gate fork-safely. No loop: the dispatch run has event=workflow_dispatch, which this job's if-condition excludes.

* ci(review): remove the fork-broken clear job, unify clearing via review-clear

The old clear job ran on pull_request_review and could not write on fork PRs (read-only token → 403), so it never cleared fork approvals. review-clear.yml now handles clearing for all PRs via workflow_run + fork-safe flag re-dispatch. Remove the redundant clear job. Add a tiny review-anchor job that runs on approval so the Review signal workflow reliably completes (not skipped), guaranteeing review-clear's workflow_run fires.
@cixzhang cixzhang added community Authored by a community contributor (not on the eng/design team) and removed community Authored by a community contributor (not on the eng/design team) labels Jul 12, 2026
@cixzhang
cixzhang merged commit 0aad623 into facebook:main Jul 12, 2026
25 checks passed
let-sunny added a commit to let-sunny/cuesheet-pipeline that referenced this pull request Jul 12, 2026
The two are views of the same cut's settings, not separate destinations, so a
segmented toggle reads truer than a tab bar. Tests select the items by
role=radio + name since @astryxdesign/core 0.1.3 doesn't forward data-testid
(upstream fix facebook/astryx#3852).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants