Checkbox
Checkbox is a form control for single and multiple selections.
Page navigation navigation
Accessibility and usability expectations
Checkboxes are most commonly used as part of a checkbox group, but a Checkbox can be used on its own. The following guidance is for a Checkbox used on its own. If using a group of checkboxes, also refer to the checkbox group accessibility guidance
Presentation
Cognition
- A
Checkboxmust have a clear, descriptive, and permanently visible label so that users understand the purpose of theCheckbox - The label should appear to the right of the
Checkboxand if there is a caption it should appear below the label - Mandatory fields must clearly convey that they are required
- Errors must be clearly identifiable
Vision
- The text label associated with the
Checkboxmust meet the minimum contrast requirements of 4.5:1 - The border of a
Checkboxmust have a minimum contrast ratio of 3:1 against the background - A
Checkboxmust have a visible focus style. A custom focus style should be used as the browser's default focus style is often hard to see against some backgrounds. A custom focus style must have a minimum contrast ratio of 3:1 against the background
Mobility
- The target size and spacing of a
Checkboxmust be at least 24 by 24 CSS pixels. This is to ensure that the element is large enough to be easily activated by users with motor impairments - A
Checkboxmust not trap focus or initiate a change of context when focused or activated
Adaptability
- Make sure that the
Checkboxcan be increased up to 200%, and any visible labels remain visible, and that the field is not clipped or hidden - The
Checkboxmust remain readable and not require horizontal scrolling to read or operate it, at a viewport size of 320 by 256 CSS pixels - When adding additional text spacing, make sure that visible labels can still be read in their entirety, and that the
Checkboxis not clipped or hidden
Interaction
Keyboard
- Unless a
Checkboxis disabled, it must by focusable using theTabkey, and pressing theSpacewill check and uncheck theCheckbox
Engineering for AT Compatibility
Screen reader
- The
Checkboxmust have an associated<label>to provide an accessible name that screen readers can announce. Any additional instructions or requirements should also be easily discoverable by screen reader users, typically by programmatically associating them with the input usingaria-describedby - The
Checkboxmust have the correctcheckboxrole to ensure that screen readers accurately convey the type of control - The checked state of a
Checkboxmust be conveyed by screen readers so people that cannot see the screen know if it is checked or not - If a
Checkboxisdisabled, thedisabledstate must be conveyed by screen readers
Speech recognition
- The accessible name must include any visible text label so that that speech recognition users can activate a
Checkboxby saying the visible text label
Built-in accessibility features
- The label, caption,
Checkboxborder, and custom focus style meet minimum contrast requirements - The text is resizable and the text spacing adjustable. The component reflows when zoomed or viewed at a width equivalent to 320 CSS pixels
- By default, the component renders a correctly associated pair of
<label>and<input type="checkbox">, ensuring theCheckboxhas an accessible name that includes any visible text - Using the the native
<input type="checkbox">ensures that theCheckboxconveys the correct role and checked state to screen readers and has the correct keyboard behavior - The caption is automatically associated with the
<input>usingaria-describedby - When the
Checkboxis disabled, thedisabledattribute is applied and the disabled state conveyed to screen readers - When the
Checkboxis given the indeterminate state,aria-checked="mixed"is applied and the state conveyed to screen readers
Implementation requirements
- Do not visually hide a
Checkbox's label - When using an icon for a leading visual, note that the icon doesn't have a text alternative. They are purely visual and not conveyed to screen readers. Don't rely on these icons alone to convey meaning, ensure that the text label of the button provides sufficient meaning/context on its own
- Ensure that the
Checkboxhas sufficient spacing from other controls, to meet the minimum target and spacing size of 24 by 24 CSS pixels
How to test the component
Integration tests
- The
Checkboxhas a clear and permanently visible label that describes the purpose of theCheckbox - If the
Checkboxincludes a leading visual icon, the input's purpose is clear from the text alone - The
Checkboxhas sufficient distance from other controls to meet the minimum target and spacing size of 24 by 24 CSS pixels
Component tests
- The component renders a correctly associated pair of
<label>and<input type="checkbox"> - The label appears to the right of the
Checkbox, and if there is a caption it appears below the label - The label and caption meet the minimum contrast requirements of 4.5:1
- The
Checkboxborder and custom focus style meets the minimum contrast requirement of 3:1 - The content remains readable, without requiring horizontal scrolling, when zoomed or viewed at a width equivalent to 320 CSS pixels
- If there is a caption, it is automatically associated with the
<input>usingaria-describedby - If the
Checkboxis disabled, thedisabledattribute is present - If the
Checkboxis indeterminate,aria-checked="mixed"is present and conveyed to screen readers