Keyboard
Ensure that users can navigate and interact with checkboxes using keyboard controls without relying solely on a mouse.
Test for desktop
- When I use the tab key to move focus to a checkbox, I see the focus is visually indicated
-
When I use the spacebar to activate the checkbox, I see the state is changed
Test for mobile
- When I use the tab key to move focus to a checkbox, I see the focus is visually indicated
-
When I use the spacebar to activate the checkbox, I see the state is changed
Test keyboard actions
- when I use the tab or arrows key to move focus to a checkbox, I see the focus is visually indicated
- when I use the spacebar, the checkbox activates on iOS and Android
- when I hit enter, the checkbox activates on Android
Screen reader
Use proper HTML semantics by associating checkboxes with labels using the for attribute or by nesting them within <label> elements.
Test a desktop screenreader
When I use a desktop screenreader such as NVDA, JAWS or VoiceOVer, I use the the tab key to move focus to a screen reader:
- I hear a clear label and understand its purpose
- I identify its role as a checkbox
- I hear hints or errors after the label, and I note that related inputs include a group name (e.g., "Account settings")
- I can tell its state whether it's checked, unchecked, or disabled
- When I use the spacebar to activate the checkbox, I hear that the state has changed
Test a mobile screenreader
When I use a mobile screenreader such as Talkback and VoiceOver, and I swipe to focus on a checkbox input:
- I hear that its label and purpose are clear
- I hear it clearly identifying its role as a checkbox
- I hear hints or errors being read after the label, and I notice that related inputs include a group name (e.g., "Account settings")
- I hear it expressing its state, whether it's checked, unchecked, or disabled
- Then, when I double-tap with the checkbox in focus, I hear that the state has changed
Test screenreader output
When I use a screenreader output
- I hear a clear label and understand its purpose
- I identify its role as a checkbox in Android and a button or checkbox in iOS
- I confirm that the visible label can be grouped with the checkbox in a single swipe
- I verify it expresses its state, whether it's disabled/dimmed, checked, not checked, selected, or unselected
Test device iOS settings
- When I resize, I scale the text label up to 200% without losing information
Aria roles and attributes
Consider using ARIA roles and attributes (e.g., role="checkbox") to enhance the accessibility of checkboxes for assistive technologies.