Accessibility issue: Unable to assign aria-label to ChoiceGroup
Environment Information
- Package version(s): 6.189.0
- Browser and OS versions: Microsoft Edge 44.17763.1.0, Microsoft EdgeHTML 18.1776, Windows 10 1809
Describe the issue:
We're trying to add an aria-label to the ChoiceGroup component for screen reader accessibility. However, there is no way to assign aria-label to a choice group.
This occurs when no label is provided in a choice group, but screen readers still need context to the options they're selecting. For example:

Please provide a reproduction of the bug in a codepen:
N/A
Actual behavior:
Can't assign aria-label as a property, only ariaLabeledBy.
Expected behavior:
an ariaLabel property is assignable in JSX, which then can be read by a screen reader. This should be on the div with the role="radio-group".
Priorities and help requested:
Are you willing to submit a PR to fix? Yes Requested priority: Normal Products/sites affected: Microsoft Power Query (PowerBI, and other consumers of Power Query)
@Quenty There's an example on the Fabric ChoiceGroup page - the "ChoiceGroup with a custom label" example that shows you can assign aria-label as a property on this component. You can see that code in the ChoiceGroup.Custom.Example.tsx. The aria spec does dictate that if there's visible text labeling the element, aria-labelledby should be used instead and that if both of these attributes are specified, ATs give precedence to aria-labelledby. Perhaps that's what's happening in your case? If you could provide a codepen with a complete repro, I can investigate further.
@aneeshack4 Thanks for the quick turn around! We have no visible label or visible text at all in our situation. I think this might be a feature request.
It's actually impossible to define aria-label in ChoiceGroup. We're asking for the ability or feature to define aria-label.
In this picture, this label works fine, because it's visible.

However, in our codebase, there is no visible label on this switcher here, for example:

Here's a codepen!
https://codepen.io/quenty/pen/ZNgYVv?&editable=true
Basically, setting property ariaLabel does nothing. Sorry for the confusion!
@aneeshack4 - @Quenty is right in saying that setting the ariaLabel prop on a ChoiceGroup wouldn't do anything. This is because, internally we do not look for it. I think, this requires a code change in the ChoiceGroup, which would respect this prop.
ChoiceGroup itself, doesn't have ariaLabel prop. However, since it is a React element, you can still use aria-label prop on it, to send in the information. @Quenty - Can you try setting arai-label prop on the CG?
So, either introduce ariaLabel prop on ChoiceGroup or if aria-label is passed respect it, if not already done.
Incredible. It works!
Thank you so much. I guess this issue was just a lack of understanding on my part on how React handles props on complex objects. Thank you so much!