-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
AVT 3 - React & Vanilla Toggle Component: VoiceOver does not announce labels #2809
Comments
it seems this directly opposes the feedback provided here #1794 |
With regard to #1794 - It states: (One screen reader that I tried said "Checkbox OffOn OffOn checked" :)
|
Hi, @snidersd! Thinking about this even more, I've realized that "On" and "Off" are actually not the toggle's label. The label would be the string that says what the toggle is for, i.e. "Show preview" or "Enable autocorrect". If we allow the screen reader to read the "On" or "Off", then we get the following, which are redundant and potentially even confusing (i.e. what does "Off not checked" mean? Does it mean "On"?):
So I think it would be best to keep the "On" and "Off" strings hidden from screen readers - do you agree? @emyarod and @asudoh, please note: A Toggle should always have a label - otherwise, how are users supposed to know what they are toggling? The label can be visible (preferred) or invisible (using either |
Hi @carmacleod, If the toggle only uses On/Off as a state and not a label, I agree that they can be hidden. But as you mentioned, there is still an issue with the component since the APG for a checkbox requires a label. |
@dakahn Please add this issue to the IBM Carbon Copy Milestone. Thx! |
ok so if I understand correctly:
<!-- current toggle example with "label" -->
<fieldset class="bx--fieldset">
<legend class="bx--label">Toggle w/ Label</legend>
<div class="bx--form-item">
<input class="bx--toggle" id="toggle2" type="checkbox">
<label class="bx--toggle__label" for="toggle2">
<span class="bx--toggle__text--left">Off</span>
<span class="bx--toggle__appearance"></span>
<span class="bx--toggle__text--right">On</span>
</label>
</div>
</fieldset> is that right? |
@emyarod Yes, that is correct. The legend is used for a group of controls to highlight common attributes of all controls, for example, to advise that all fields in the group are required. Then as shown in the APG each toggle must have an associated label. Also see additional information on Grouping Controls. |
In case it's helpful, Scott O'Hara has some decent accessible switch (aka toggle) examples here: https://scottaohara.github.io/aria-switch-control/ Looks like he was playing around with using different html elements - there's a couple that are implemented with button, one with div, one with anchor, and the last one "Enable something" uses a checkbox input inside an html label. See also: https://scottaohara.github.io/a11y_styled_form_controls/src/checkbox--switch/ |
@snidersd @carmacleod thank you for the clarification. I would appreciate your feedback and testing on #2885 which should address this issue |
Environment
Tested on macOS Mojave 10.14.5, Version 74.0.3729.157 (Official Build) (64-bit), with VoiceOver
Description
Tab to the default toggle component.
Click on the Enter or Space Key
VoiceOver does not announce the On / Off label
Note: It looks like aria-hidden="true" was recently added to the toggle component. If the aria-hidden is removed the label is read correctly. (see screenshot)

The text was updated successfully, but these errors were encountered: