Skip to content

Disabling Radio FormControl in RadioGroup results in axe violation #2634

Description

@calvinchilds

Description

To disable a certain Radio button in a RadioGroup of FormControls, you need to set the disabled prop on the FormControl element of the radio option. If you do, you get the following axe violation

helpers.ts:37 [Critical] [aria-disabled] may be used in place of native HTML [disabled] to allow tab-focus on an otherwise ignored element. Setting both attributes is contradictory.

https://www.w3.org/TR/html-aria/#docconformance-attr

When you inspect the element in the DOM it indeed has both disabled and aria-disabled="true" HTML attributes.

Steps to reproduce

Render this JSX:

<RadioGroup name="options">
  <RadioGroup.Label>Options</RadioGroup.Label>
  <FormControl>
    <Radio value="option1" />
    <FormControl.Label>Option 1</FormControl.Label>
  </FormControl>
  <FormControl disabled>
    <Radio value="option2" />
    <FormControl.Label>Option 2</FormControl.Label>
  </FormControl>
</RadioGroup>

Version

35.14.2

Browser

Chrome

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions