Skip to content

fix(RadioList): preserve focus and block disabled activation - #9301

Closed
korkt-kim wants to merge 1 commit into
meta:mainfrom
korkt-kim:korkt-kim/ast-085-radiolist-draft
Closed

korkt-kim wants to merge 1 commit into
meta:mainfrom
korkt-kim:korkt-kim/ast-085-radiolist-draft

Conversation

@korkt-kim

Copy link
Copy Markdown
Contributor

User impact

A selected RadioList option can become disabled while a person is using the keyboard. Without a group disabledMessage, the radio receives native disabled, leaves the focus order, and loses focus. An individually disabled option has the same problem. With a reason, the group is described, but the focused radio does not receive that reason.

This draft keeps the existing radio focusable and non-operable, without requiring a reason. It is not ready to merge: the browser checks still reproduce the two regressions below.

Problem and solution fit

The disabled rendering path depends on whether a group reason exists. Native disabled prevents discovery and focus retention; simply removing it would allow native activation and submit disabled values.

The change uses aria-disabled, guards owned click/capture and activation-key callbacks, and composes the group reason with each radio's existing description. Disabled radios have no form owner and use a private per-list name, so separate forms sharing htmlName do not collapse into one native group. A private context coordinates member updates, required validation, and Tab entry; a limited arrow fallback connects the split native groups. Caller-owned slot controls keep their own behavior.

Expected behavior and authority

These links pin the authority at this change's merge base. No specification is changed here.

Smallest restoration

  • Update RadioList and RadioListItem, with one private context and no new public context fields.
  • Keep nine focused cases in the existing RadioList.test.tsx; extend its existing pointer, Space, and ArrowDown checks with capture assertions. No separate regression suite is added.
  • Update the shared accessibility expectations and the existing DisabledWithMessage story to cover the actual radio's description.
  • Correct the consumer documentation for native names, caller cancellation, and tooltip behavior; add a patch changeset identifying the switch from native disabled to aria-disabled.

Evidence

The same temporary source-rendered fixture ran against base a587813542 and head 68458a6eb7 in Playwright Chromium and WebKit, with 57 observations per revision. The fixture and evidence files are not part of the implementation diff.

  • Before: focus B, then disable either the group or B alone. Both browsers drop focus to the page. Chromium's accessibility tree gives B its option description but not the group reason.
  • After: the same transitions retain focus on B and exclude its value from FormData. Space on the wholly disabled group changes neither selection nor callbacks. Chromium exposes both the option description and the disabled reason on B.
  • Representative unchanged path: in an LTR form with B selected and C disabled, ArrowLeft still selects A, submits delivery=a, and invokes each applicable callback once in both browsers. Unit tests also verify callback and submission recovery after re-enabling.
  • Regression proof: the consolidated cases detect eleven deliberately broken in-memory source variants: native disabled, click/capture/key guards, reason composition, form exclusion, native-name isolation, required normalization, member synchronization/detachment, and visibility observation. Production files were not modified by these probes.

These are source-rendered browser observations and DOM tests, not a built-Storybook audit or real assistive-technology speech verification. Visual evidence is still pending.

Remaining draft blockers

  1. WebKit arrow navigation regresses in forms. With A/B/C/D, B selected, and C individually disabled, ArrowRight stays on B; the base advances to D. The form-associated path bypasses the fallback.
  2. Required validation regresses before hydration. With a selected disabled option and an enabled sibling, server-rendered markup is invalid in Chromium and WebKit. The base is valid. Disabled values are excluded, but client normalization repairs validity only after hydration.
  3. Current-main integration is pending. This overlaps the existing draft fix(RadioList): disabled radios stay focusable, and arrow keys skip disabled options #8823. The disabled-reason repair has since landed in fix(RadioList): a disabled group's reason describes each radio #9169; merging current main into this head reports conflicts in RadioList.tsx and RadioListItem.tsx. This draft does not supersede either PR or claim those conflicts are resolved.

Scope

  • One intent: preserve disabled RadioList discovery, focus, and non-operability, with the required form behavior.
  • Redundant test matrices, extra demo stories, and unrelated comment/documentation rewrites were removed.
  • No new public prop, theme contract, visual representation, or specification is introduced. Native-behavior parity remains incomplete as described above.
  • Public text and artifacts contain no internal Meta context.

Testing

Validation of the tree committed as 68458a6eb7:

  • pnpm exec vitest run --project ui packages/core/src/RadioList — 4 files, 109 tests passed.
  • pnpm -F @astryxdesign/core typecheck — source and consumer-documentation types passed.
  • pnpm build — passed.
  • pnpm lint:strict — passed with 0 errors and 135 warnings; repository checks passed.
  • Scoped Prettier, active LSP check of the changed test file, git diff --check, and normal pre-commit hooks — passed.
  • pnpm test --maxWorkers=4 --bail=1 — stopped at packages/cli/test/global-local.test.mjs:407: an expected upgrade notice is undefined. That file is outside this diff, and the same case fails alone with pnpm exec vitest run --project node packages/cli/test/global-local.test.mjs -t 'in a fresh clone, doctor names' --maxWorkers=1. The full suite is not reported as passing.
  • Browser parity, rendered visual evidence, and current-main integration — pending as described above.

Keep disabled radios mounted and focusable, guard activation callbacks,
and attach disabled reasons to the radios. Coordinate native group and
form state through a private context without extending the public context
API.

Keep nine focused regressions in RadioList.test.tsx, extending the existing
pointer and keyboard callback checks rather than adding separate suites.

Validation: 109 RadioList tests, Core source/docs typechecks, the full build,
and strict lint pass. The full test run stops at an upgrade-notice assertion
in packages/cli/test/global-local.test.mjs.

Known remaining regressions are WebKit navigation across disabled options
and required validity before hydration with a selected disabled option.
@vercel

vercel Bot commented Nov 1, 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 1, 2026 10:51am UTC

Request Review

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

astracat-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
📝 Draft — not reviewed automatically (for maintainers only) Nov 1, 2026, 11:42 AM UTC

@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 1, 2026
@korkt-kim korkt-kim closed this Nov 1, 2026
cixzhang added a commit that referenced this pull request Nov 1, 2026
@github-actions
github-actions Bot deleted the korkt-kim/ast-085-radiolist-draft branch November 2, 2026 13:57

This branch was successfully deployed

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

Labels

CLA Signed This label is managed by the Meta Open Source bot. 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant