Sub topic 10
Making cues and feedback accessible
This chapter assumes you know basic HTML and CSS, and that you have met signifiers (cues that reveal possible actions) and feedback (the system's response to an action) in earlier chapters. Here you will check whether those cues and responses reach every user, including people who cannot see color, cannot see the screen, cannot use a mouse, or cannot hear a sound.
Why accessible cues matter
A signifier or a feedback message does its job only if the user can perceive it. Many designs quietly fail this test:
- A red border marks an invalid field, but a user with red-green color blindness sees no change.
- A "Saved" toast appears for two seconds, but a screen reader user never hears it.
- A hover effect shows that a card is clickable, but a touch or keyboard user never triggers hover.
- A beep confirms a scan, but the user is in a loud room or is deaf.
Each case reopens one of Norman's two gulfs. The gulf of execution widens when a user cannot tell what can be done. The gulf of evaluation widens when a user cannot tell what happened.
The usual fix is redundancy. Carry each important cue in more than one channel, such as shape plus color, or text plus sound. Then losing one channel does not lose the message.
The perceivable, operable, understandable frame
The Web Content Accessibility Guidelines (WCAG) organize requirements under four principles: perceivable, operable, understandable, and robust. Three of them map directly onto this tutorial's topics.
| WCAG principle | Question for signifiers | Question for feedback |
|---|---|---|
| Perceivable | Can every user detect the cue? | Can every user detect the response? |
| Operable | Can every user act on what the cue promises? | Can every user trigger and dismiss the response? |
| Understandable | Does the cue say what will happen? | Does the response say what happened and what to do next? |
The fourth principle, robust, means your markup works with assistive technology such as screen readers. Native HTML elements are the simplest way to get this.
Accessible signifiers
Do not rely on color alone
WCAG success criterion 1.4.1 (Use of Color) says color cannot be the only way to convey information. Pair color with a second cue: text, an icon, an underline, a border style, or a pattern.
Links inside body text are the classic case. If links differ from surrounding text only by color, many users cannot find them. Keep the underline.
a {
color: #0b5fff;
text-decoration: underline;
}
a:hover {
text-decoration-thickness: 2px;
}For form errors, combine a color change with an icon and a text message:
.field--invalid input {
border: 2px solid #b00020;
}
.field--invalid .error::before {
content: "⚠ ";
}Check contrast
Signifiers need enough contrast against their background. WCAG 2.1 sets these minimums:
| Element | Minimum contrast ratio | Criterion |
|---|---|---|
| Body text | 4.5:1 | 1.4.3 |
| Large text (about 24px, or 19px bold) | 3:1 | 1.4.3 |
| Boundaries of controls and icons needed to identify them | 3:1 | 1.4.11 |
The third row is easy to miss. A text field with a pale gray border on a white page can fail even if its label passes. If the border is the only thing that shows where to type, it is a signifier and needs 3:1.
The disabled state is a special case. WCAG exempts inactive components from contrast minimums. Even so, a disabled button that is nearly invisible gives the user no clue that it exists. Keep it readable, and explain why it is disabled where you can.
Make focus visible
Hover is a signifier for mouse users only. Keyboard users rely on the focus indicator to see where they are. WCAG 2.4.7 requires a visible keyboard focus indicator, and 2.4.11 in WCAG 2.2 adds requirements for its minimum size and contrast so it is not obscured.
Never remove the outline without replacing it:
/* Bad: removes the only keyboard signifier */
button:focus { outline: none; }
/* Good: shows focus for keyboard users with strong contrast */
button:focus-visible {
outline: 3px solid #ffbf47;
outline-offset: 2px;
}:focus-visible shows the ring when the browser judges it useful, which is normally for keyboard navigation. Mouse clicks on buttons usually do not trigger it, so you avoid a ring that mouse users find distracting.
Make targets big enough to hit
A button that looks pressable but is hard to hit still fails. WCAG 2.2 criterion 2.5.8 sets a minimum target size of 24 by 24 CSS pixels. Platform guidance is larger: Apple recommends 44 points and Material Design recommends 48 dp. Padding counts toward the target, so you can keep a small icon and enlarge the clickable area.
Use real controls
A native <button> already carries its role, keyboard behavior, and focus handling. A <div> styled to look like a button carries none of these. If a screen reader user lands on the div, nothing tells them it is pressable, so the signifier exists only visually.
<!-- Bad: looks like a button, announces as plain text -->
<div class="primary" onclick="save()">Save</div>
<!-- Good: role, focus, Enter and Space all work -->
<button type="button" class="primary" onclick="save()">Save</button>If you must build a custom control, you need to supply what the browser would have given you: a role, tabindex="0", key handlers, and state attributes. Reaching for the native element is almost always less work and less risk.
Expose state to assistive technology
Visual state needs a programmatic twin. A toggle that turns blue when on needs to tell a screen reader that it is on.
<button type="button" aria-pressed="false" id="mute">Mute</button>
<script>
const mute = document.getElementById("mute");
mute.addEventListener("click", () => {
const pressed = mute.getAttribute("aria-pressed") === "true";
mute.setAttribute("aria-pressed", String(!pressed));
});
</script>Style from the attribute so the visual and programmatic states cannot drift apart:
button[aria-pressed="true"] {
background: #0b5fff;
color: #fff;
}Accessible feedback
Announce changes with live regions
When content changes without moving focus, a screen reader says nothing by default. A live region is an element that the browser watches. When its text changes, assistive technology announces the new text.
There are two common politeness levels:
| Mechanism | Behavior | Use for |
|---|---|---|
| `role="status"` (implies `aria-live="polite"`) | Waits until the user is idle, then announces | Saved, loading finished, item added |
| `role="alert"` (implies `aria-live="assertive"`) | Interrupts the current speech | Errors that block progress, session expiry |
Use assertive sparingly. Interrupting a user to say "Draft autosaved" is more harmful than silence.
Two details cause most live-region bugs:
- The region must exist before its content changes. If you insert a brand-new
role="status"element already containing text, many screen readers will not announce it. Put an empty region in the page at load and fill it later. - Change the text, do not replace the element. Update
textContenton the same node.
The save example from the earlier chapters follows both rules:
<button id="save" type="button">Save</button>
<p id="status" role="status"></p>
<script>
const button = document.getElementById("save");
const status = document.getElementById("status");
button.addEventListener("click", async () => {
button.disabled = true;
status.textContent = "Saving…";
try {
const response = await fetch("/api/save", { method: "POST" });
if (!response.ok) throw new Error("HTTP " + response.status);
status.textContent = "Saved.";
} catch (error) {
status.textContent = "Could not save. Check your connection and try again.";
} finally {
button.disabled = false;
}
});
</script>One more gotcha: setting disabled on a focused button makes the browser drop focus, so a keyboard user can be thrown back to the top of the page. Where that matters, use aria-disabled="true" and ignore clicks in your handler, so focus stays put.
Move focus when the message needs attention
A live region suits short, passive updates. For a form that fails validation, announcing alone is not enough. The user also needs to find the problem fields. A common pattern is:
- On submit, validate.
- Build an error summary at the top that lists each problem as a link to its field.
- Move focus to that summary, so the screen reader reads it.
- Mark each invalid field with
aria-invalid="true"and tie its message to it witharia-describedby.
<label for="email">Email</label>
<input id="email" type="email" aria-invalid="true" aria-describedby="email-error">
<p id="email-error" class="error">Enter an email address like [email protected].</p>Now the field's name, its invalid state, and the fix are read together when the user focuses it. This applies the earlier chapter's rule for error text: say what happened and how to recover, and place the message next to the cause.
Do not hide feedback too fast
Toasts that disappear after a few seconds fail users who read slowly, use magnifiers, or need time to reach the message. WCAG 2.2.1 (Timing Adjustable) requires that time limits can be extended or turned off, with exceptions. For messages that matter, keep them until the user dismisses them, or place the result in the page where it stays. A toast can still be fine for low-stakes confirmation if the same information is available elsewhere.
Offer more than one modality
Earlier you compared visual, auditory, and haptic feedback. For accessibility, the rule is that no single modality carries a critical message alone.
- A sound needs a visible or text equivalent, for people who are deaf or have the volume off.
- A visual flash needs a text or audible equivalent, for people who cannot see it.
- A vibration needs a visual twin, since many devices have it off.
- Flashing content must not flash more than three times per second (WCAG 2.3.1), which can trigger seizures.
Respect user preferences about motion. Animated feedback such as a spinning or bouncing indicator can cause discomfort for some users, and the operating system lets people ask for less:
.spinner {
animation: spin 1s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
.spinner {
animation: none;
}
.spinner::after {
content: "Loading…";
}
}The reduced-motion branch swaps the animation for text, which keeps the feedback while removing the motion.
Progress needs a programmatic form too
A visual progress bar tells sighted users how far along an operation is. Use the native <progress> element, which exposes its value to assistive technology, instead of an empty styled <div>:
<label for="upload">Uploading report.pdf</label>
<progress id="upload" max="100" value="40">40%</progress>Do not announce every percent through a live region. That floods the user with speech. Announce the start, major milestones, and the end.
How the pieces fit
Testing accessible cues
You cannot judge accessibility by looking at the screen alone. Use a short routine:
- Keyboard only. Unplug the mouse. Can you reach and operate every control? Is the focus always visible?
- Screen reader. Turn on VoiceOver, NVDA, or TalkBack. Perform the action. Do you hear what the control is, its state, and the result?
- Grayscale. Switch the display to grayscale or use a color-blindness simulator. Is every state still distinguishable?
- Zoom to 200 percent. Do messages stay visible and unclipped?
- Mute the sound. Is every sound-based message also shown?
- Automated check. A tool such as axe or Lighthouse catches missing labels and low contrast, but not whether your feedback makes sense. It finds only a fraction of issues, so treat it as a supplement.
Common errors
- Removing
outlinewith no replacement. - Using color alone for validation, status, or required fields.
- Building clickable
<div>or<span>elements with no role or key handling. - Inserting a live region at the same moment as its text.
- Using
role="alert"for routine updates, which interrupts users repeatedly. - Vague icon-only buttons. Give them an accessible name, such as
aria-label="Close". - Relying on placeholder text as the label. It disappears on input and often has poor contrast.
- Disabling a button after click without telling anyone why or what comes next.
Summary
Accessible cues and feedback follow one idea: deliver each important message through more than one channel, and make sure one of those channels is available to assistive technology. Use native controls, keep focus visible, pair color with another cue, announce changes through live regions that exist before they change, and give users enough time to read what the system tells them.
Exercise
A form's Submit button turns green on success and shows a small green checkmark that fades after one second. Nothing else changes. Name at least three accessibility problems and one fix for each.
Show answer
First, the success is shown by color (green) and a checkmark only, so a screen reader user receives nothing. Fix: write "Form submitted" into an existing role="status" region. Second, the checkmark fades after one second, which is too short for slow readers or magnifier users. Fix: keep a text confirmation visible until the user moves on. Third, green versus the previous color may be indistinguishable for color-blind users, and the checkmark may have low contrast. Fix: rely on the text message and ensure the icon meets 3:1 contrast. A fourth issue: if the button is disabled during submission, keyboard focus may be lost. Fix: use aria-disabled and keep focus in place.
Exercise
You add a <div role="status"> to the page by JavaScript at the moment a save finishes, with the text "Saved." already inside it. Some screen reader users report hearing nothing. Why, and how do you fix it?
Show answer
Many screen readers only announce changes to a live region that already exists in the page. A region inserted together with its text produces no change event to announce. Fix: include an empty role="status" element in the initial HTML, then set its textContent to "Saved." when the save finishes.
Exercise
A text field has a 1px light gray (#ccc) border on a white background, and its label is dark and readable. Does it meet WCAG 2.1, and why does it matter for signifiers?
Show answer
It likely fails criterion 1.4.11 (Non-text Contrast). #ccc on white has a contrast ratio of about 1.6:1, below the 3:1 minimum for the boundary of a control that is needed to identify it. The border is the signifier that shows where to type, so users with low vision may not see the field. Fix: use a darker border, such as #767676 or darker, which reaches at least 4.5:1 on white, or add another visible cue such as a background fill that meets 3:1.