Toggle Component: Improve accessibility
See original GitHub issueDescription
The Toggle component is not accessible in it’s current state.
Needs:
- Keyboard handling (press “enter” to toggle)
- label validation - if no label provided, add hidden label for screen readers.
aria-checked
attribute
Versions
fundamental-react: 0.3.0.rc-2 fiori-fundamentals:
NOTE: Where applicable, please include uncropped screen captures.
DISCLAIMER: After triaging an issue, the fundamental-react team will see if it can be reproduced or confirmed. If more information is needed, the fundamental-react team will contact the author. Any issues awaiting responses from the author for more than 7 days will be closed. The author can re-open the issue at a later time if they can present the requested information.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Accessibility - Toggle - Carbon Design System
A toggle is a control that is used to quickly switch between two possible states. They are commonly used for “on/off” switches.
Read more >Building accessible toggle buttons (with examples for Svelte ...
Toggle buttons might be the biggest missing native HTML element. This post will help you code them right, for all users, in any...
Read more >Building Inclusive Toggle Buttons - Smashing Magazine
In this inaugural post, I'll be exploring what it takes to make toggle buttons inclusive. As with any component, there's no one way...
Read more >An accessible toggle | Kitty Giraudel
In this article, I will show a small HTML + CSS only implementation of an accessible toggle that you can basically copy in...
Read more >Accessibility first: toggle switches - DEV Community
If the element is disabled we want to somehow show the user they can't interact with it. What I like to do is...
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 Free
Top 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
@jbadan I guess having the
aria-label
set on theinput
is better. That way, we don’t have to add, associate and style anotherlabel
element. Also I thinkaria-label
should be a required prop.I think we can set the default for our playground pages - but the custom proptype we use for localization will make it required: https://github.com/SAP/fundamental-react/blob/master/src/utils/CustomPropTypes/CustomPropTypes.js#L78 (seen used here in Counter: https://github.com/SAP/fundamental-react/blob/e3e6c9ae7986085a4ce65b39d2da853db258fd06/src/Counter/Counter.js#L36)