Radiobutton component should render with only one label
See original GitHub issueFollowing the comment in the PR #1359 The radiobutton are mounting with two label thus throwing an wcag2 exception where a form element needs to have only one label. Having more then one label may confuses the screen readers.
<label className={classes}>
<input {...props} className={`${CLASS_ROOT}__input`}
type="radio" />
<span className={`${CLASS_ROOT}__control`} />
<label htmlFor={props.id} className={`${CLASS_ROOT}__label`}>
{label}
</label>
</label>
Expected Behavior
The radio input should render with one label attach to it.
Actual Behavior
The radio input currently have two label, causing accessibility issues.
URL, screen shot, or Codepen exhibiting the issue
With the use of react-axe in my project, I was able to notice the issue. The issue is display as follow:
https://dequeuniversity.com/rules/axe/2.3/label?application=axeAPI
Your Environment
- Grommet version: 1.5.0
- react-axe: 2.1.7
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
React radio input only changes when label is clicked
I created a controlled component for a radio input. the radio button doesn't get checked unless I click on the label.
Read more >How to Use Radio Buttons in ReactJS | Pluralsight
Using a Radio Button Group. Radio buttons let a user choose a single option from a list of multiple radio buttons and submit...
Read more >Radio Buttons In React.js
Let's start with creating radio button elements. In render() function we'll write JSX code that creates <form> element with 3 <input> elements nested...
Read more >Radio button with label - Auro Design System - Alaska Airlines
The auro-radio component is rendered as a small circle, which is filled or highlighted when selected. Only one auro-radio component in a given...
Read more >Radio Button
You can use the Radio Button component to represent a set of options, only one of which can be selected at any time....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
fixed by https://github.com/grommet/grommet/pull/1443
Thanks again @jlevesque
Hey @jlevesque ! Great catch! It is definitely a goal of Grommet’s to be accessible and we take violations of the WCAG audit seriously. I will leave this up for now so that we can get it on our backlog. That said, if you feel compelled to try to help us resolve this, we would love for you to work on a PR!