Skip to content

FBK-004 Announce a status message without moving focus

Level
Rule
Verdict
Requirement
Status
decided, version 1.0.3

Rule

When a message about a result, a wait, progress or an error appears while focus stays where it is, give it a role or property that lets assistive technology announce it without it taking focus. Our own way, which WCAG does not prescribe, is a polite live region, with role="alert" kept for an error or warning that needs attention now.

Examples

Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.

Do: The save line is a live region

Draft saved at 14:05

Type a few words in Meeting notes and stop. After a second the line says "Saving draft …", then "Draft saved at" the time. The line is a status region that was there from the start, so a screen reader reads each change while focus stays in the text. One save per pause, not one per key. The dashed box shows what is sent to the live region.

Don't: The same line, not announced

Draft saved at 14:05

Type and stop. The line changes just as in the Do, but it is a plain paragraph. A screen reader user hears nothing, and cannot tell that the draft is saving or that it was saved.

Why

A sighted person notices when a line on the screen changes. A screen reader user hears only what is at focus, so a new line somewhere else on the page passes in silence unless the code marks it as something to announce. WCAG 2.2, 4.1.3 Status Messages requires that such a message can be found by assistive technology through its role or properties, without the message taking focus. WCAG accepts any programmatic way to do that. A polite live region and the role alert are common ways, not the only ones. Choosing between polite and alert is our rule, in line with common practice; WCAG does not require it. A polite status waits until the screen reader has finished what it is saying. An alert breaks in at once, and a page that breaks in too often teaches people to stop listening. What the view itself shows after a change is covered by FBK-003, and where a failed action is shown by FBK-002. This rule covers how the message reaches assistive technology.

Do

  • Our own choice, as the rule says: make the polite live region with role="status" or aria-live="polite".
  • A person books a meeting and picks another room in a list. The line below changes from "Room Oak is free all afternoon" to "Room Linden is free all afternoon", and focus stays in the list. The whole line is read, so the person hears the sentence and not a bare "Linden". role="status" reads the whole region by default; with aria-live="polite" alone, add aria-atomic="true".
  • A document saves on its own. A role="status" line shows "Saving draft …" and then "Draft saved at 14:05". When a wait ends, replace the busy text with a short result instead of only removing it, so a screen reader user learns that the wait is over.
  • Our own point, not a claim from WCAG or the sources: put the empty live region in the page with the page or the component, well before any message, and write the text into it later. Many pairs of browser and screen reader only announce changes inside a live region they already know about. To announce the same text twice, clear the region first.
  • A person ticks In stock only in a filter, and the line above the list says "3 items match" from a polite live region while focus stays on the checkbox.
  • Our own list of what needs attention now: work that is about to be lost, a lost connection and a time limit that is about to pass (STA-004). Other messages are polite. A field's error may use either, as described below.
  • The connection drops while the person is editing. A role="alert" line says "Connection lost. Your changes will not be saved until you are back online." This is a warning that needs attention now, so it may break in.
  • A person leaves Email with an address that has no @ and the field's error appears, as FRM-002b describes. Focus stays on the next field and the error is announced from the live region tied to the field. Polite and alert both fit this rule. Our components use a polite region, so the error waits until the next field's label has been read instead of talking over it. That is our reasoning, not a source's.
  • An upload of 12 files says "Uploading 12 files" when it starts, gives a short update at sensible steps such as "6 of 12 files uploaded", and ends with "12 files uploaded". Announce once per real change. For a running sequence of updates, role="log" also fits.
  • Five filters are cleared with one press. Announce one message, "Filters cleared, 120 items match", not five.
  • Watch changes to Stop watching when the person presses it on a listing, so the label names what the next press does, as ACT-001a says. Also write "You are now watching this listing" into a polite live region. Some screen readers do not announce a change to the name of the control that has focus. That is our own point.
  • A status shown as an icon, such as a green tick next to a row, has a text alternative such as "Synced" as well as the live region, as WCAG 2.2, 1.1.1 Non-text Content asks.
  • When a form moves focus to a field after sending, turn off that field's live announcement for that moment, so the error is not read twice.

Don't

  • Add a live region to the page at the same moment as its text, for example a box reading "Thank you, your application has arrived" put in place of a form. The region did not exist before the message, so the announcement is often lost (our point, see above). Keep the region in the page from the start instead. If the control that had focus disappears, as a send button does when the form is replaced, move focus to the result, as the first exception allows.
  • Put role="alert" on "Draft saved", "3 items match" or "Loading …". Routine news should not break in.
  • Announce every percent of an upload, or a character count such as "73 characters to go" on every key press.
  • Move focus to a "Draft saved" message just to make it heard.
  • Remove "Loading …" with nothing in its place.
  • Show a status only as a colour or an icon, with no text for assistive technology.

Exceptions

  • Messages shown by moving focus or by loading a new page. These are not status messages, so this rule does not apply. When a form is sent with problems and focus moves to the first problem or to a summary, as the guideline FRM-011 describes, the message is reached by focus. That message needs no live region. The same holds for a dialog that takes focus and for a new page that shows a result.
  • Messages with an action. Where focus goes for a message that carries an action is not decided by this rule. For a message with Undo, DST-001a decides it. If focus stays where it is, the message's text is still announced.
  • Content that is not a message. A menu, an accordion or a tab that opens is not a status message; its changed state is covered by WCAG 2.2, 4.1.2 Name, Role, Value. New questions added after an answer and the list of search results itself are not status messages either. Only the short line about the results, such as "3 items match", is a status message.

Verdict

Requirement. Only the judges decide; the expert witnesses are shown but do not vote. How verdicts work

Stances on FBK-004
SourceRoleStancePage
WCAG 2.2LawRequires4.1.3 Status Messages
WCAG 2.2LawSupports1.1.1 Non-text Content
Material DesignJudge SupportsSnackbar: accessibility
Snackbar: guidelines
Text fields: accessibility
Apple Human Interface GuidelinesJudge SupportsFeedback
Carbon Design SystemJudge SupportsNotification: accessibility
Notification: usage
Notifications
GOV.UK Design SystemExpert witness No position
Nielsen Norman GroupExpert witness No position

Each stance links to the page it rests on, read on the date in the source register. This page never repeats what a source says; read the source itself.

History

  • Version 1.0.3, : Shorter rule sentence; the detail moved to Do. No change in what the rule asks. Focus on a failed send now refers to FRM-011.
  • Version 1.0.2, : The rule sentence now separates what 4.1.3 requires from our own way of doing it; lists what needs attention now; the toggle example names the next press.
  • Version 1.0.1, : Examples in English.
  • Version 1.0.0, : First version.

Last checked against the other rules for conflicts on .

More in Feedback: 4 rules and 0 guidelines · All rules