Checkbox 1: Simple Checkbox
Authoring Practice Design Patten for button
Coding Example
Label 1
Label 2
Label 3
Accessibility Feature
div
element withrole="checkbox"
.div
element hasonclick
event to handle mouse clicks.div
element hasonkeydown
event to handle keyboard support.div
element hastabindex="0"
to become part of tab order of the page.img
elements are used to visually indicate the state because using css techniqes or generated content result in visual state disappearing when browsers or operating systems are configured to display high contrast themes.toggleCheckbox(event)
usesaria-checked
state to make sure the ARIA and visual state (e.g.img
element) of the checkbox stay synchronizd.focus
blur
events are used to provide visual styling of keyboard focus.
Keyboard Support
Key | Function |
---|---|
Tab | Moves keyboard focus to checkbox. |
Space | Toggle the checkbox option either true or false. False is the default. |
ARIA Roles, Properties and States
Role | Property/State | Usage |
---|---|---|
checkbox | Identify div as Checkbox widget. | |
aria-checked |
Indicate state of checkbox:
|
Source Code
- CSS: checkbox.css
- Javascript: checkbox.js