third_party/aria-practices/src/content/patterns/checkbox/examples/checkbox-mixed.html
This example demonstrates using the Checkbox Pattern to create a tri-state, or mixed-state, checkbox. In this implementation, the mixed-state checkbox represents the state of a set of standard HTML checkboxes. If none of the checkboxes in the set are checked, the mixed state checkbox is not checked, and if all members of the set are checked, the mixed state checkbox is checked. If the set contains both some checked and unchecked checkboxes, the mixed state checkbox is partially checked. Activating the tri-state checkbox changes the states of the checkboxes in the set.
Similar examples include:
Sandwich Condiments All condiments
fieldset element which is labeled by a legend element.currentcolor value for the stroke property of the rect and polyline elements used to draw the checkbox. To make the background of the checkbox graphics match the high contrast background color, the fill-opacity attribute of the rect element is set to zero. If specific colors were instead used to specify the stroke and fill properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the checkbox and the background or even make the checkbox invisible if the color matched the high contrast mode background.forced-color-adjust property set to auto for the currentcolor value to be updated in high contrast mode. Some browsers do not use auto for the default value.| Key | Function |
|---|---|
| Tab | Moves keyboard focus among the checkboxes. |
| Space |
|
| Role | Attribute | Element | Usage |
|---|---|---|---|
checkbox | div |
div element as a checkbox.div provides the accessible name of the checkbox.|
| | tabindex="0" | div | Includes the checkbox in the page tab sequence. |
| | aria-controls="[IDREFS]" | div | identifies the set of checkboxes controlled by the mixed checkbox. |
| | aria-checked="false" | div |
checkbox is not checked.[aria-checked="false"]) are used to synchronize the visual states with the value of the aria-checked attribute.::before pseudo element and content property are used to generate the visual indicators of the checkbox state.|
| | aria-checked="true" | div |
checkbox is checked.[aria-checked="true"]) are used to synchronize the visual states with the value of the aria-checked attribute.::before pseudo element and content property are used to generate the visual indicators of the checkbox state.|
| | aria-checked="mixed" | div |
checkbox is mixed.[aria-checked="mixed"]) are used to synchronize the visual states with the value of the aria-checked attribute.::before pseudo element and content property are used to generate the visual indicators of the checkbox state.|
To copy the following HTML code, please open it in CodePen.