Form hints: connect help + errors with aria-describedby

A short, practical UI accessibility note for games and web UIs. No tracking.

Try the micro-demo: form-hints-demo.html

It compares visible-but-unlinked hint/error text (BEFORE) vs a field that references them via aria-describedby (AFTER).

What goes wrong

Many UIs show helpful text under a field (requirements, examples) and then show an error message when validation fails. Visually, it looks fine — but if the input isn’t connected to that text, assistive tech can miss it or present it inconsistently.

Minimal pattern

Use a real label for the field’s name, then use aria-describedby for extra description (help text, requirements, and (optionally) the current error message).

Minimal sketch:

<label for="pw">Password</label>
<div id="pw-help">Use 8+ characters. Add a number.</div>
<div id="pw-err" hidden>Use at least 8 characters.</div>

<input id="pw" type="password"
  aria-describedby="pw-help"
  autocomplete="new-password" />

When validation fails, show the error and add it to aria-describedby, plus aria-invalid="true".

When error is present:

// show error text
pwErr.hidden = false;

// make it programmatically associated
pw.setAttribute('aria-invalid', 'true');
pw.setAttribute('aria-describedby', 'pw-help pw-err');

Checklist / gotchas