A repository of styled and “styled” form control patterns, and how they are announced by screen readers.
Form controls are necessary in many interfaces, but are often considered annoying, if not downright difficult, to style. Many of the markup patterns presented here can serve as a baseline for building more attractive form controls without having to exclude users who may rely on assistive technology to get things done.
How you design and implement your toggle buttons is quite up to you, but I hope you’ll remember this post when it comes to adding this particular component to your pattern library. There’s no reason why toggle buttons — or any interface component for that matter — should marginalize the number of people they often do.
You can take the basics explored here and add all sorts of design nuances, including animation. It’s just important to lay a solid foundation first.
- Use form elements such as checkboxes for on/off toggles if you are certain the user won’t believe they are for submitting data.
<button>elements, not links, with
- Don’t change label and state together.
- When using visual “on” and “off” text labels (or similar) you can override these with a unique label via
- Be careful to make sure the contrast level between the button’s text and background color meets WCAG 2.0 requirements.
See the source link for very detailed descriptions of all of these points.