Accessibility
The colour picker targets WCAG 2.1 AA and follows the WAI-ARIA radio group pattern.
For designers
Section titled “For designers”- Always show the colour name as text. Colour alone can’t identify an option for people with colour vision deficiencies. Source: WCAG 1.4.1 Use of Color.
- Use plain-language names (for example “Midnight Black”), not internal product codes. Source: WCAG 2.4.6 Headings and Labels.
- Never remove or obscure the blue focus ring. Source: WCAG 2.4.7 Focus Visible.
- Use Small swatches only in non-touch or secondary contexts. Every swatch keeps a 44 px touch target. Source: WCAG 2.5.5 Target Size.
For developers
Section titled “For developers”Group the swatches in a <fieldset> whose <legend> names the group (for example “Exterior colour”). Each swatch is a native radio, or a <button>; never a <div>. Its accessible name is the colour name, from the image’s alt or an aria-label. A button communicates selection with aria-pressed, or with aria-checked inside a role="radiogroup". Sources: WCAG 1.3.1 Info and Relationships, WCAG 4.1.2 Name, Role, Value.
Disable a swatch with the native disabled attribute, so it can’t be focused or activated. A disabled swatch may fall below the contrast minimum. Source: WCAG 1.4.3 Contrast (Minimum).
When the selection changes an image elsewhere on the page, such as the car, update that image’s alt to the new colour, so screen-reader users learn about the change.
Keyboard interaction
Section titled “Keyboard interaction”Radios:
| Key | Action |
|---|---|
| Tab | Move focus into the group, to the selected swatch |
| Arrow keys | Move to the next or previous swatch and select it |
| Space | Select the focused swatch, if it isn’t selected |
Buttons:
| Key | Action |
|---|---|
| Tab | Move focus to the next swatch |
| Enter / Space | Select the focused swatch |