question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Radiobutton component should render with only one label

See original GitHub issue

Following 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: screen shot 2017-07-20 at 3 44 44 pm

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:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
alansouzaticommented, Jul 21, 2017
1reaction
RyanCCollinscommented, Jul 21, 2017

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found