Hint
How the Hint works with a keyboard and assistive tech, and where it stands against WCAG 2.2 AA.
The Hint is the line of text under a field. It is plain text, so all it needs is to be linked to its field and to say clearly what to do. An error hint is announced as soon as it appears.
Keyboard#
The hint is not focusable. It is read with its field when the field takes focus.
Semantics#
id + aria-describedbyThe field points at the hint's id, so the hint is read after the field's name and role.
Alwaysrole="alert"The error is announced as soon as it is shown. Show errors on blur or submit, not on every keystroke, or it will interrupt constantly.
erroraria-invalidSet on the field, not the hint, so the field itself is announced as invalid.
erroraria-hidden="true"The info glyph is decorative; the text carries the meaning.
IconColour contrast#
Every variant and state has to meet WCAG 2.2 Level AA. Measure the colours as they land on screen: a translucent hover or press wash over whatever sits behind it.
Hint text · Default, Success
12px text in #6d6d6d passes. Success text in #229a14 is 3.68:1 on white, and fails.
WCAG 1.4.3 Contrast (Minimum) ↗Error text · Error
#ec0d33 on white is 4.49:1, a hair under 4.5:1 at 12px.
WCAG 1.4.3 Contrast (Minimum) ↗Error not by colour · Error
Red is backed by the words of the error and by aria-invalid on the field. Write the message so it makes sense without the colour.
WCAG 1.4.1 Use of Color ↗WCAG 3.3.1 Error Identification ↗Icon · All
The glyph is decorative, so it has no minimum. Default #8f8f8f and error #f34261 are both over 3:1 regardless.
WCAG 1.4.11 Non-text Contrast ↗Disabled · Disabled
Inactive controls are exempt. The disabled text and glyphs (#cbcbcb) are deliberately faint.
WCAG 1.4.3 Contrast (Minimum) ↗Measured contrast#
The hint's text and glyph on a white page in each state, from the ds.css tokens; text is held to 4.5:1 and the icon, a graphic, to 3:1. 2 of 9 pairs fall below their minimum (4.5:1 for text, 3:1 for graphics) and are marked in amber.
Motion#
- The hint does not animate.
Checklist#
Every hint has an id that its field lists in aria-describedby.
Write errors as a fix, not a verdict: Enter a date after today, not Invalid date.
Error red (#ec0d33, 4.49:1) and success green (#229a14, 3.68:1) are under 4.5:1 at 12px and need darker shades before the code library ships.
Keep the hint to one short sentence. Longer help belongs in the label's help line or beside the form.
Don't hide guidance in the placeholder. Placeholder text disappears as soon as someone types; the hint stays.
