In striving for WCAG 2.0 Compliance, I'm finding quite a bit of varied information regarding proper treatment of buttons, specifically what is required to consider the button accessible and compliant.
What is the appropriate way to mark-up a <button>
? What attributes or combination do they need to have?
My buttons fall into three categories:
- Buttons that have text that describes their intended action. (e.g. "Learn More" to launch a modal with more product information)
- Buttons that have text that does not describe their action. (e.g. "X" or text that titles a section of accordion content)
- Buttons that do not have text that describes their intended action or otherwise. (e.g. An icon / image that switches the context of a carousel)
For instance, in the following simple example of 3 above: http://codepen.io/ga-joe/pen/ggeLeW
Is it acceptable to add only an aria-label
attribute for a button with no text? Are name
and / or value
always required? Please send help! Thank you!
These seem to be the relevant WCAG Guidelines: