Skip to content

fix(RadioList): disabled radios stay focusable, and arrow keys skip disabled options - #8823

Draft
cixzhang wants to merge 23 commits into
mainfrom
lane4/radiolist-focusable-disabled
Draft

cixzhang wants to merge 23 commits into
mainfrom
lane4/radiolist-focusable-disabled

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Part of #7817 (the RadioList half; the other choice controls shipped in #7824)

User impact

Keyboard and screen-reader users can't reach a RadioList that is disabled without a disabledMessage. Its radios render the native disabled attribute, so Tab skips the whole group and a screen reader moving by focus never hears that the question exists or that it's locked. In a settings form with a locked "Delivery speed" choice, a keyboard user sees one question fewer than everyone else.

After this change a disabled radio is reachable and announced as disabled, with or without a reason. It still can't be selected or submitted. Arrow keys keep skipping an individually disabled option, as they do today.

Problem and solution fit

  • Why do they miss it? RadioList and RadioListItem render native disabled unless the whole group has a disabledMessage, and the browser takes natively disabled radios out of the tab order.
  • Why does that harm the task? Focus-based navigation is how keyboard and screen-reader users discover what a form asks. A question that never takes focus doesn't exist for them.
  • Why does it matter? It's the same defect spec:AST-085 removed from every other choice control. RadioList was split out of that fix only because its arrow-key rule wasn't decided yet; RadioList's record now decides it (see below).

The fix replaces native disabled with aria-disabled and keeps the native radio group whole: one name, one form owner, one Tab stop. The browser keeps handling arrow keys, except that a move onto a disabled option goes on to the next enabled one.

Expected behavior and authority

  • spec:AST-085 FR1–FR4, FR6 and FR7: no native disabled; aria-disabled with the enabled focus order; every change path blocked; no submitted value and no blocked submit; focus kept when a control becomes disabled; the focus indicator still shows.
  • component:RadioList FR4/FR5 and component:RadioListItem FR6/FR7, as amended here for consistency: AST-085 leaves arrow-key visiting to the composite, and RadioList keeps skipping individually disabled options (the ButtonGroup FR8, Calendar and shared list-focus precedent). A disabled option takes focus by Tab only when it is the group's Tab stop (the selected option, or a wholly disabled group).

Smallest restoration

  • RadioListItem

    • aria-disabled="true" replaces native disabled.
    • A disabled radio runs no caller onClick.
    • The indicator focus ring shows on a focused disabled radio.
  • Submission (FR3), decided at render, so the first render is final:

    • A wholly disabled group detaches every radio from the form together (form=""). Its radios take the group's internal name instead of htmlName (they submit nothing), so two disabled groups sharing a field name in different forms stay apart. RadioList FR2, its Name concept, the htmlName docs and the changeset say so.
    • A selected, individually disabled radio stays in its form, so the group keeps one form owner, one Tab stop and a satisfied required. Its value leaves the submitted entries through the form's formdata event, an effect that installs and removes one listener on the form owner.
    • Detaching only that radio would split the native group: two Tab stops, and a required group whose in-form half has nothing checked would block the submit.
    • A disabled radio is not required, so a required group whose options are all disabled blocks no submit. One enabled option keeps the choice required.
    • An unselected disabled option stays in the form and submits nothing, because it's unchecked.
  • Keyboard (FR4)

    • In a group with no disabled option, the browser's native radio arrow keys apply.
    • In a group with any disabled option, every arrow key goes through the shared list focus hook, useInternalListFocus, as SegmentedControl's does. It moves focus to the next enabled radio in that direction (the inline-end arrow forward, mirrored in RTL), wrapping as the native group does, or stays put; RadioList selects the radio it lands on. Owning every move keeps one direction rule in every engine (WebKit doesn't mirror horizontal arrows in RTL).
    • Modifier keys are ignored. A caller onKeyDown runs first and can opt out with preventDefault.
    • Whenever no radio is checked, the Tab entry lands on the first or last enabled radio; a wholly disabled group enters on its first or last radio.
  • Before hydration: server markup carries no native disabled either, so a disabled radio is focusable before hydration too (spec:AST-085 FR1).

    • A wholly disabled group's radios carry form="" in server markup, so it submits nothing before hydration.
    • An individually disabled option can still be checked by a click or the arrow keys until the page hydrates, and a form submits a checked one, including one selected from the start. The RadioList and RadioListItem records say so: they claim spec:AST-085 FR2 and FR3 only once hydrated.
    • Server markup and the first client render match, so there's no hydration mismatch.
  • Docs: RadioList's docs and the disabledMessage JSDoc no longer say disabled controls swallow hover events. The reason now also describes each radio.

  • Not in this PR

    • Two focus indicators on an option (RadioListItem OQ1).

Merged with main

Evidence

Real Chrome 156 (headless, DPR 2), Storybook built from main at 6162917 and from this branch, served locally. The same keyboard probe ran each disabled state of the radio-group a11y stories: Tab from the page start, then the arrow keys.

State Step main This PR
Express disabled, Standard selected Tab Standard Standard
ArrowDown Overnight, selected (skips Express) Overnight, selected (skips Express)
ArrowUp Standard, selected Standard, selected
Group disabled, no reason Tab nothing: focus stays on the page Standard, aria-disabled, focus ring shown
ArrowDown nothing stays on Standard, nothing selected
Group disabled with a reason Tab Standard, aria-disabled Standard, aria-disabled
ArrowDown focus moves to Express, still unselected stays on Standard, nothing selected

In every state the disabled radios on this branch carry aria-disabled and no disabled attribute.

  • Regression tests: RadioList.focusableDisabled.test.tsx, 21 cases. 10 fail on main:

    • native disabled on an item-disabled option and on a group disabled without a reason;
    • focus kept on disable;
    • arrow keys skipping a disabled option forward, backward and in RTL;
    • staying put in a wholly disabled group;
    • Tab entry past a disabled first or last option, and into a wholly disabled group.
  • The remaining 11 guard paths the new implementation could break:

    • a disabled click runs no onChange or onClick;
    • an enabled next option stays the browser's move;
    • modifier keys are ignored;
    • a caller onKeyDown still runs;
    • form cases: a group disabled without a reason submits nothing; an unselected disabled option keeps the group's form owner; a required group whose selected option is disabled stays valid with one form owner, on the first render; a required group with every option disabled stays valid, and one enabled option keeps it required; two disabled groups sharing a field name stay apart.
  • RadioListDisabledForm.interaction.browser.spec.ts: real-browser proof of the submitted entries (jsdom fires no formdata event), over three no-visual fixtures. The same checks in real Chrome 156 on this head:

    Fixture Submitted entries checkValidity() Tab stops
    Required group, selected option Express disabled, plus a hidden order field order=1001 only true Express only
    Required group, every option disabled, none selected none true the first radio only
    Two disabled groups named delivery in two forms none, none true, true one per group, each keeping its own checked radio
  • The radio-group a11y binding now expects radio-list-option-group-disabled to be reached by Tab.

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm vitest run for RadioList and Field on the merged head: 286 pass (earlier, before the merge: RadioList, SegmentedControl, CheckboxList, Field and Form, 415 pass).
  • The real-browser form spec and the radio-group a11y bindings run again on this head in CI.
  • tsc --noEmit for core, eslint, prettier, pnpm check:knowledge, pnpm check:changesets.
  • The real-Chrome probe above, main versus this branch.

Writing rubric results

  • R1 narration: one found. The new arrow-key decision said disabled options "keep skipping … after they become focusable"; rewritten in the present tense.
  • R2 research: none in the records.
  • R3 evidence: none. Basis cells cite records and tests; the new decision cites the ButtonGroup, Calendar and list-focus precedents as facts.
  • R4 rejected alternatives: none recorded.
  • R5 change references: none.
  • R6 open questions: RadioListItem OQ1 and OQ2 stay unanswered and keep their options; RadioList has none.

Credit

@korkt-kim also proposed keeping a disabled radio focusable and inert in #9301, which is now closed. The changeset credits it.

Co-authored-by: korkt-kim [email protected]

Owner: fix-loop lane 4. Land path: Held for the owner's input-hardening decision; then the remaining review fix, CI, and the drain merges.

@vercel

vercel Bot commented Oct 28, 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 8, 2026 11:48pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 28, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Oct 28, 2026
@astracat-bot

astracat-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 11, 2026, 3:48 PM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Oct 28, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 2e28665

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

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


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for closing the RadioList gap: disabled radios now take focus and announce as disabled, and the arrow-key skip and Tab entry behave as the updated records describe. Three issues need fixing before this can be approved:

  • A required RadioList whose options are all isDisabled, with nothing selected, now blocks its form and moves focus to a disabled radio; keeping required off disabled radios (RadioListItem.tsx line 336) restores native behavior.
  • With form="", two disabled RadioLists that share an htmlName in different forms become one native radio group, so one loses its checked state and its Tab stop; naming detached radios with a name unique to their group (line 335) keeps them apart.
  • The selected-disabled registration is a layout effect that sets RadioList state after a first render that leaves the radio in the form; please decide the detachment during render, or name the external system the effect synchronizes, as the React runtime architecture asks (lines 285-289).

[Automated review]

A selected, individually disabled radio stays in its form and its value
leaves the submitted entries through the form's formdata event, so the
first render is final. A disabled radio is not required. Detached radios
take a name unique to their group, so disabled groups that share a field
name in different forms stay apart. Real-browser spec and fixtures for
the submitted entries.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec c531b76

…lue matching no option is no selection

WebKit does not mirror horizontal arrows in a right-to-left radio group, so
predicting the browser's next radio landed on a disabled option there. In a
group with any disabled radio RadioList now moves every arrow itself; a group
without one keeps the browser's arrows. The Tab entry correction now runs
whenever no radio is checked, including a value that matches no option. The
changeset names the old and new behavior and its accessibility target.

@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 making RadioList's disabled radios reachable: Tab now lands on a group disabled without a reason, focus stays put when a group is disabled, and the focus ring shows. Approval waits on a spec decision, because this head rewrites RadioList FR2, FR4 and FR5 and RadioListItem FR6 (the generated name for a disabled group, scripted arrow-key skipping and Tab entry, and a selected disabled radio that stays in its form with its value removed only after hydration) and the earlier /approve-spec comments named earlier commits; an engineering owner records that decision by commenting /approve-spec 870158dd5c95573d9c96cc10a7cf5b7eb30ac521 on this pull request, and the author may do so if they are an engineering owner. Independently of that decision, these still need changes:

  • Server-rendered markup submits a selected, individually disabled option's value until hydration, against AST-085 FR3 (RadioListItem.tsx lines 286-305).
  • In WebKit right to left, ArrowRight lands on a disabled option and ArrowLeft jumps the other way, because the skip assumes the engine mirrors horizontal arrows (RadioList.tsx lines 111-123 and 436-473).
  • A value that matches no option lets Tab land on a disabled first option (RadioList.tsx line 372), and the changeset should name the accessibility target it serves (AST-017 FR53).

[Automated review]

// value leaves the entry list, as a natively disabled radio's would
// (spec:AST-085 FR3).
const excludesValue = isItemDisabled && isChecked && !context.isDisabled;
useEffect(() => {

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 effect is the only thing that keeps a selected, item-disabled radio's value out of the form, so server-rendered markup submits it until hydration: FormData over the server-rendered fixture gives delivery=express, order=1001 here and order=1001 on the base. AST-085 FR3 says a disabled field contributes no value; deciding the exclusion in the rendered markup, or an AST-085 amendment for the pre-hydration window, would close it, and the changeset should say so either way.

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 8, 2026
@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec e3199d5

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 8, 2026

@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: disabled RadioList radios are meant to stay reachable by keyboard and announced as disabled, and the rewritten RadioList and RadioListItem records are approved at this head, but the head does not load and four things need fixing.

  • Regression: RadioList.tsx:97 still calls createContext, which the merge with main removed from the imports, so importing RadioList or @astryxdesign/core throws ReferenceError: createContext is not defined; create the context with createLayerScopedContext('RadioListFormContext', 1, null) as RadioListContext does.
  • Before hydration an individually disabled option can be checked by a click and is then submitted, and a selected one is submitted from the server markup (delivery=express), which contradicts spec:AST-085 FR2 and FR3; amend AST-085 in this pull request to scope that window, or keep the value out of the submission in markup.
  • The 119 files under packages/core/src/i18n/generated-english/ are generated output that .gitignore and architecture:internationalization keep out of version control, so remove them from the branch.
  • The changeset says a disabled radio submits no value, and the description still describes native disabled until hydration and 286 passing tests, while this head submits a disabled option before hydration and its RadioList tests do not load; update both to match the code.

With the import fixed, the RadioList suite passes locally.

[Automated review]

…her contexts

Main now builds Core's contexts through the layer-scoped shared factory,
so two copies of Core's modules share one context. The form context
follows it, and the browser spec imports Playwright through the
a11y-spec wrapper.
@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 6ff2be9

@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: disabled RadioList radios now stay reachable by keyboard and are announced as disabled under the approved RadioList and RadioListItem records, but the three issues from the last review still stand, and CI found one more.

  • Before the page hydrates, a click checks an individually disabled option and a form then submits it, and a selected disabled option is submitted straight from the server markup (delivery=express), which contradicts spec:AST-085 FR2 and FR3; amend AST-085 in this pull request to scope that window, or keep the value out of the submission in markup.
  • Found by CI: the required lint check fails because the new comments in RadioList.tsx and RadioListItem.tsx cite spec:AST-085 and its FR numbers beyond the comment-provenance baseline, so drop those citations and keep the reasons.
  • The 119 files under packages/core/src/i18n/generated-english/ are generated output that .gitignore and architecture:internationalization keep out of version control, so remove them from the branch with git rm -r --cached packages/core/src/i18n/generated-english.
  • The changeset says a disabled radio submits no value, and the description says it renders native disabled until hydration and can't be selected or submitted, while this head lets an individually disabled option be checked and submitted before hydration; update both to match the code.

The RadioList tests and the core typecheck pass at this head; CI's other test and build jobs were still running when this review was written.

[Automated review]

@cixzhang
cixzhang marked this pull request as ready for review November 8, 2026 22:47
@cixzhang
cixzhang marked this pull request as draft November 8, 2026 23:10
…d English, and qualify the changeset

The comment-provenance rule allows only baselined sites, so the new
comments keep their reasons without citing AST-085. The generated
English files are build output the ignore file covers. The changeset
says an individually disabled option can be checked and submitted
until hydration, and names the WCAG targets.
@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 82ec94d

@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: disabled RadioList radios now stay reachable by keyboard and are announced as disabled under the approved RadioList and RadioListItem records, and the lint, generated-file and changeset issues from the last review are fixed. One issue remains.

  • Before the page hydrates, a form submits a selected, individually disabled option (delivery=express), and a click or ArrowDown checks an unselected disabled option that is then submitted, which contradicts spec:AST-085 FR2 and FR3; recording the window in the RadioList records does not amend AST-085, so amend AST-085 FR2 and FR3 in this pull request to scope the pre-hydration window, or keep the value out of the submission in markup.

Two smaller points are in the inline comments: the before-hydration notes leave out that a click also checks a radio in a wholly disabled group, and two comments were left broken when their citations were removed. CI has not run on this head yet.

[Automated review]

…s click too, and two comments reflow

A click checks a radio of a wholly disabled group in server markup as
well, against AST-085 FR2, though that group submits nothing. Two
comments left broken by the citation removal are joined and reflowed.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 8, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner: the last commit rewords RadioListItem FR6 and the pre-hydration notes in both records, so the rewritten RadioList and RadioListItem records need a spec approval at this head. An engineering owner records it by commenting /approve-spec 38ee57cf1715b9e9b485bee76895626c28e4af7e on this pull request; the author may do so if they are an engineering owner.

  • Before the page hydrates, a click or an arrow key checks a disabled option and a form submits a checked, individually disabled one (delivery=express from server markup), which contradicts spec:AST-085 FR2 and FR3; describing the window in the component records does not amend AST-085, so amend AST-085 FR2 and FR3 in this pull request or keep the value out of server markup.

The earlier notes on the wholly disabled group's pre-hydration click and the two broken comments are fixed. Two non-blocking comment notes are inline.

[Automated review]

// is not silenced by the browser, so drop the handler here
// (`spec:AST-085` FR2), as CheckboxInput does.
// to the input — the same routing CheckboxListItem uses.
// A disabled radio runs no caller onClick.

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.

Non-blocking, missed in the last review: this line restates onClick={isDisabled ? undefined : onClick}. Keep only the reason, for example // The browser does not silence an aria-disabled radio, so drop the handler.

// from submission, matching a natively disabled control.
form={keepsFocusableForMessage ? '' : undefined}
required={context.isRequired}
// A disabled radio stays focusable, in server

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.

Non-blocking, missed in the last review: this line breaks after "in server" at 54 characters, left by the removed citation. Join it with the next line and reflow the comment.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 38ee57c

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026

@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: once the page hydrates, disabled RadioList radios are reachable by keyboard, announced as disabled, skipped by the arrow keys and left out of the submission, and the RadioList and RadioListItem record changes are owner-approved for this head. One defect remains:

  • Before the page hydrates, a click or an arrow key checks a disabled option, and a form submits a checked, individually disabled one (the server markup submits delivery=express, and delivery=overnight after a click on the disabled Overnight), which contradicts spec:AST-085 FR2 and FR3; the component records describe this gap but do not amend AST-085, so either amend AST-085 FR2 and FR3 in this pull request or keep the value out of the server markup.

One new non-blocking comment note is inline; the two comment notes from the last review still apply.

Automated review (maintainer link)

Comment on lines +420 to +429
* Arrow keys skip individually disabled options. The browser's radio group
* would move onto an `aria-disabled` radio, so in a group with any disabled
* radio every arrow move goes through the shared list focus, as
* SegmentedControl's does: focus goes to the next available radio in the
* same direction (the inline-end arrow forward, mirrored in right-to-left),
* wrapping as the native group does, or stays put when there is none, and
* the radio it lands on is selected. Owning every move, not only the ones
* that would land on a disabled radio, keeps one direction rule in every
* engine (WebKit does not mirror horizontal arrows in right-to-left). A
* group with no disabled radio keeps the browser's own arrow keys.

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.

Non-blocking, missed in earlier reviews: the second sentence of this JSDoc runs about 70 words and joins four topics. Shorter sentences keep only the reason, for example: "The browser's radio group moves onto an aria-disabled radio. In a group with a disabled radio, the shared list focus moves every arrow key, skips disabled radios and wraps. RadioList owns every move, because WebKit does not mirror horizontal arrows in right-to-left."

This branch was successfully deployed

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant