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

Switch toggle state sometimes reported incorrectly #1435

Closed
afercia opened this issue Jun 26, 2017 · 4 comments
Closed

Switch toggle state sometimes reported incorrectly #1435

afercia opened this issue Jun 26, 2017 · 4 comments
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Jun 26, 2017

Looks like the switch toggle state is sometimes reported incorrectly. While, visually, everything looks OK, in some cases the actual state seems reported wrongly when using a screen reader. Testing with Safari + VoiceOver:

correct: "unchecked"

screen shot 2017-06-26 at 11 13 19

incorrect: "checked"

screen shot 2017-06-26 at 11 13 29

incorrect: "unchecked"

screen shot 2017-06-26 at 11 13 35

@afercia afercia added the [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). label Jun 26, 2017
@afercia
Copy link
Contributor Author

afercia commented Jun 26, 2017

Can reproduce also with Firefox + NVDA:

screenshot 114

@afercia
Copy link
Contributor Author

afercia commented Jun 26, 2017

I'm a bit surprised by how react treats the checked attribute, see facebook/react#7051 and how it is deviating from simple, basic HTML requirements. These kind of deviations can easily produce side effects, like in this example. Following these React patterns, it may appear explicitly setting a checked attribute is not really needed. Instead, omitting it causes a serious accessibility issue.
Looks like just explicitly adding a checked attribute, even if it's not printed in the DOM, fixes the issues because software, including screen readers, rely on its presence.

@afercia afercia added the [Type] Bug An existing feature does not function as intended label Jun 26, 2017
@youknowriad
Copy link
Contributor

I think we should probably use the checked prop instead of the value (we're currently using). I suspect this would resolve the issue.

@afercia
Copy link
Contributor Author

afercia commented Jun 26, 2017

@youknowriad yep adding a checked attribute seems to fix it, see the PR.

youknowriad pushed a commit that referenced this issue Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants