UI Patterns
Feedback

Announcements

Screen reader feedback — live regions when the message is on screen, ariaNotify when it isn't, and what actually gets spoken across screen readers.

The other feedback pages each end with "and announce it". This page is about that last step. It's a requirement, not a nicety: WCAG 2.2 SC 4.1.3 Status Messages asks that results, waiting states, progress and errors that appear without moving focus reach assistive technology too — "Let assistive technology notify users about status changes that don't take focus."

None of the demos can make your screen reader talk on this page's behalf, so each one has a log of what a screen reader would receive. Turn on VoiceOver (⌘F5) or NVDA to hear the real thing.

Should it be announced at all?

The ariaNotify explainer describes the etiquette screen reader users expect: "user actions where the context is clear are assumed to be successful by virtue of issuing the command … however, if the action fails, is delayed, or no focus or state changes are generated, the user should then be notified."

  • Announce: errors, things taking longer than usual, results of an action that didn't move focus ("18 results"), side effects ("Autofilled A2 to A20"), keyboard commands with no visible change.
  • Don't announce: what focus already says, every keystroke, loaded content itself (search results are not a status message; "18 results" is), decorative updates.
  • Don't use a live region at all when the message needs action. Live regions read plain text — buttons and links inside them aren't conveyed, and focus doesn't go there. An "Undo" toast in a live region is unreachable for many users; Sara Soueidan recommends moving focus to a persistent message (or an alertdialog) instead.

Visible message: make that element the live region

If sighted users see the message, the same element should be the live region — "if the update or message is visible to all users and the conveyed text is equivalent to the visible text … designate it as a live region so that all users get the same update" (Soueidan, part 1).

The region has to exist before its text changes: "place the live region container in the DOM as early as possible and then populate it … Otherwise, the update may not be communicated to screen readers." That is the most common live-region bug, and it's easy to write in React:

Region mounted with message
What a screen reader would get:
Region rendered up front

What a screen reader would get:
// ❌ mounts the region together with its first message
{count > 0 && <p role="status">{count} items in cart</p>}

// ✅ region always rendered, only its text changes
<p role="status">{count > 0 ? `${count} items in cart` : ""}</p>

Which role:

MarkupBehaves asUse for
role="status"politeResults, "Saved", counts — most status messages
<output>polite (implicit status)Result of a calculation or user action; can be labelled with <label>
role="alert"assertiveErrors that need attention now
aria-live="polite" / "assertive"as namedWhen you need the behaviour without the role's meaning

Keep the content short plain text — rich content isn't conveyed, and wrapping a whole section in a live region reads it as one long string.

Repeated messages

A live region announces changes. Setting the same text again — or in React, rendering the same string again — changes nothing in the DOM, so nothing is spoken. Click each Save a few times:

Same message every time

0 clicks · 0 announcements
What a screen reader would get:
Message says when

0 clicks · 0 announcements
What a screen reader would get:

The robust fix is in the words, not in tricks: a message that differs each time ("saved at 14:02:31", "attempt 2") is also more useful to read. The error shake demo does the same with an attempt count.

No visible message: ariaNotify()

Some feedback has nothing on screen to point at: a keyboard shortcut that toggles bold, a keyboard drag reporting the new position, a paste that failed because the clipboard was empty. The traditional workaround is a visually hidden live region that exists only to be spoken. document.ariaNotify() replaces it — the explainer's goal is to "replace the usage of ARIA live regions in scenarios where a visual 'live region' isn't necessary."

Reorder the list with Alt + ↑/↓ (or the arrow buttons):

Focus an item, then press Alt + ↑ or Alt + ↓ to move it.

  1. 1. Pancakes
  2. 2. Omelette
  3. 3. Granola
  4. 4. Shakshuka
What a screen reader would get:

Install with the shadcn CLI, or copy the source below.

npx shadcn@latest add https://ui-patterns.stereobooster.com/r/announce.json
lib/announce.ts
declare global {
  interface Document {
    ariaNotify(
      announcement: string,
      options?: { priority?: "normal" | "high" },
    ): void;
  }
}

export type Politeness = "polite" | "assertive";
export type AnnounceMethod = "ariaNotify" | "live-region";

const VISUALLY_HIDDEN: Partial<CSSStyleDeclaration> = {
  position: "absolute",
  width: "1px",
  height: "1px",
  padding: "0",
  margin: "-1px",
  overflow: "hidden",
  clip: "rect(0, 0, 0, 0)",
  whiteSpace: "nowrap",
  border: "0",
};

function getRegion(politeness: Politeness) {
  const existing = document.querySelector<HTMLElement>(
    `[data-announcer="${politeness}"]`,
  );
  if (existing) return { region: existing, created: false };
  const region = document.createElement("div");
  region.dataset.announcer = politeness;
  region.setAttribute("aria-live", politeness);
  Object.assign(region.style, VISUALLY_HIDDEN);
  document.body.append(region);
  return { region, created: true };
}

/**
 * Creates the fallback live regions. Call once, as early as possible —
 * a region created at the moment of the first message is often missed.
 */
export function ensureAnnouncer() {
  getRegion("polite");
  getRegion("assertive");
}

export function canAriaNotify() {
  return typeof document !== "undefined" && "ariaNotify" in document;
}

/**
 * For messages with no visible counterpart. When the text is on screen,
 * make that element the live region instead.
 */
export function announce(
  message: string,
  {
    politeness = "polite",
    forceLiveRegion = false,
  }: { politeness?: Politeness; forceLiveRegion?: boolean } = {},
): AnnounceMethod {
  if (!forceLiveRegion && canAriaNotify()) {
    document.ariaNotify(message, {
      priority: politeness === "assertive" ? "high" : "normal",
    });
    return "ariaNotify";
  }

  const { region, created } = getRegion(politeness);
  const node = document.createElement("div");
  node.textContent = message;
  // A fresh node per message is an addition even when the text repeats;
  // replacing the region's text with identical text changes nothing.
  setTimeout(() => region.append(node), created ? 150 : 0);
  setTimeout(() => node.remove(), created ? 1150 : 1000);
  return "live-region";
}

The fallback regions are created once at app start (ensureAnnouncer() in the root provider), not on the first message.

Notes from MDN:

  • Support: Chrome 141, Firefox 150, Safari 27 (MDN compatibility data). Recent everywhere, so keep the fallback — and, as Adrian Roselli points out, shipped doesn't yet mean consistently spoken.
  • Priority: normal ≈ aria-live="polite", high ≈ "assertive". Live-region announcements take priority over ariaNotify ones.
  • Combine messages. Several calls in a row may be queued — or only the last one spoken, depending on the screen reader. Send one sentence.
  • It doesn't need a user gesture, so nothing stops it from being spammy. That's on you.
  • It counts for WCAG. SC 4.1.3 "applies more generally to programmatically determinable ways to convey status messages, including direct access to accessibility APIs that result in assistive technology alerts/announcements."
  • Language comes from <html lang>.

Screen readers disagree

Adrian Roselli's live region support tests (January 2026, seven screen reader / browser pairs, current and older versions) show how little of the spec you can rely on:

  • assertive is mostly treated as polite. JAWS, NVDA, Narrator, Orca and TalkBack all speak it politely; only VoiceOver interrupts.
  • Even "polite" differs: JAWS and NVDA speak at the next break, which "is not at end of sentence"; Narrator waits for the sentence; Orca for the end of the visual line.
  • VoiceOver on macOS skips polite regions during read-all.
  • role="alert" says "alert" only in NVDA, and Orca doesn't announce alerts at all.
  • Behaviour changes between versions — TalkBack went from treating every region as assertive (v13) to polite (v16).
  • Hidden regions never announce (hidden, aria-hidden, display: none) — the one consistent result.

What that means for writing messages:

  • Never rely on interruption. Write messages that make sense whenever they are spoken.
  • Put the meaning in the words — "Error: card declined", because "alert" is almost never announced.
  • Test on more than one screen reader, at minimum VoiceOver plus NVDA or JAWS, and re-test after updates. Link to Roselli's table rather than copying it — it changes with every release.

Further reading

On this page