Skip to Content
Component ExamplesLive Regions

Overview

Live regions allow screen readers to announce dynamic content changes without the user having to move focus. Two levels exist: role="status" (polite — waits for the user to finish what they’re doing) and role="alert" (assertive — interrupts immediately). The most critical rule: the live region element must exist in the DOM before content is injected into it.

WCAG Criteria:

Key requirements:

  • Use role="status" for non-urgent updates (cart counts, success messages)
  • Use role="alert" for urgent errors and warnings
  • The live region element must be present in the DOM on page load
  • Do not use aria-live on dynamically created elements — it won’t work
  • aria-atomic="true" causes the full region to be re-read on each change (useful for counters)

Status Update (Polite)

Cart Counter with role=status vs. No Live Region

Inaccessible
<!-- No live region — screen reader never announces the cart update --> <button onclick=" var el = document.getElementById('bad-cart'); var n = parseInt(el.textContent) + 1; el.textContent = n + ' item' + (n === 1 ? '' : 's'); "> Add to Cart </button> <div id="bad-cart">Cart: 0 items</div>
Live Preview
Cart: 0 items
Accessible
<!-- role="status" announces changes politely without interrupting --> <button onclick=" var count = parseInt(document.getElementById('cart-count').dataset.count || 0) + 1; document.getElementById('cart-count').dataset.count = count; document.getElementById('cart-status').textContent = 'Cart: ' + count + ' item' + (count === 1 ? '' : 's'); "> Add to Cart </button> <!-- Live region exists on page load — content is updated, not the element --> <div id="cart-status" role="status" aria-atomic="true"> Cart: 0 items </div>
Live Preview
Cart: 0 items

Alert (Assertive)

Persistent Alert Region vs. Dynamically Created Error

Inaccessible
<!-- Dynamically created element — live region property not recognized --> <button onclick=" var err = document.createElement('div'); err.setAttribute('role', 'alert'); err.textContent = 'Session expired. Please log in again.'; document.body.appendChild(err); "> Simulate Error </button>
Live Preview

The dynamically created alert element will not be announced by most screen readers.

Accessible
<!-- Alert container exists in DOM from page load — only content changes --> <div id="error-banner" role="alert" hidden></div> <button onclick=" var banner = document.getElementById('error-banner'); banner.textContent = 'Session expired. Please log in again.'; banner.removeAttribute('hidden'); "> Simulate Error </button> <!-- To clear: set textContent to '' and re-hide -->
Live Preview

Key Concepts Reference

aria-live Values

ValueBehaviorImplicit Role
politeWaits for user to finish current activityrole="status", role="log"
assertiveInterrupts immediatelyrole="alert"
offNo announcements (useful during auto-rotation)

aria-atomic

  • aria-atomic="true" — the entire region is re-read on any change (good for counters: “Cart: 3 items”)
  • aria-atomic="false" (default) — only the changed nodes are read (good for chat logs where only new messages matter)
  • role="status" has aria-atomic="true" by default; role="log" has aria-atomic="false" by default

aria-relevant

Controls which types of changes trigger announcements:

  • additions — new nodes added (default for most live regions)
  • removals — nodes removed
  • text — text content changed
  • all — shorthand for additions removals text

Most of the time, the default (additions text) is correct. Only set aria-relevant explicitly if you need removal announcements.

Throttling Rapid Updates

Rapid live region updates flood the speech queue, making the screen reader unusable. Best practices:

  • Debounce updates — wait 500ms+ after the last change before updating the live region
  • Announce at thresholds — “10 results”, “50 results”, “100 results” instead of every increment
  • Use aria-live="off" during auto-play/auto-scroll, switch to "polite" for manual interaction
  • Never use role="alert" for frequent updates — it interrupts every time

Resources