Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing doc in radiobutton can lead to accessibility problems #6829

Closed
carmacleod opened this issue Sep 14, 2020 · 1 comment · Fixed by #7846
Closed

Missing doc in radiobutton can lead to accessibility problems #6829

carmacleod opened this issue Sep 14, 2020 · 1 comment · Fixed by #7846

Comments

@carmacleod
Copy link
Contributor

carmacleod commented Sep 14, 2020

  1. Go to the doc for RadioButtonGroup: https://react.carbondesignsystem.com/?path=/docs/radiobuttongroup--default
  2. Look for the "legend" prop - it's not there
  3. Go back to https://react.carbondesignsystem.com/?path=/docs/radiobuttongroup--default
  4. Click on the RadioButton docs tab to see what props it supports - there aren't any: "No props found for this component"
    • it's important to mention value here
    • might also want to mention that id will be generated if not provided (might want to mention that in a lot of places, or point to a common place in the doc where this is described) (id is important for accessibility here, because it hooks up the for attribute of the label so that it is programmatically associated with the radio).
  5. Go to https://www.carbondesignsystem.com/components/radio-button/code
  6. Open a code sandbox
  7. Remove the <FormGroup> and </FormGroup> so that you are just left with the <RadioButtonGroup>
    • run the AccessibilityChecker and note the violations for "Radio input and others with the name "radio-button-group" are not grouped together"
    • now look at the generated DOM, and notice that there's no fieldset generated? Also, no legend? (even though there's a legend prop on the RadioButtonGroup?)
    • if this "FormGroup" is a required parent in order for a RadioButtonGroup to work accessibly, then the documentation needs to say so (i.e. not just having it in the example code). Authors could easily decide to delete the FormGroup, thinking that the RadioButtonGroup alone will generate the fieldset and legend. It is not clear why this parent is needed.
@carmacleod
Copy link
Contributor Author

carmacleod commented Sep 14, 2020

After playing with the sandbox a bit more, it seems that only the FormGroup legend is used? The legend prop on the RadioButtonGroup is not used? Why is it in the sample code?

Bottom line is this: All doc related to RadioButtons, RadioButtonGroups and FormGroups needs to be fixed up in all the places, and have more detail added about what parts are needed for this whole construct to be accessible.

[Edit: The API designers should probably take a good hard look at why RadioButtonGroup doesn't generate a fieldset and set the fieldset's legend... i.e. maybe instead of deleting the RadioButtonGroup's legend from the sample code, Carbon should support it on RadioButtonGroup, not require a FormGroup parent for a stand-alone RadioButtonGroup, and generate the fieldset with the RadioButtonGroup legend. If an author has a FormGroup parent with only a single RadioButtonGroup child, then you don't need to generate 2 nested fieldsets... so either need to collapse them into one fieldset using one of the legends, or document that authors shouldn't do that. DM me if this needs clarification.]

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