HTML Academy · Lesson

Live Regions aria-live aria-atomic aria-relevant

Announce asynchronous updates to assistive technology.

Lesson 3 of 413 steps

Live Regions aria-live aria-atomic aria-relevant is a free HTML Academy lesson on CoddyKit. This is lesson 3 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the HTML Academy learning path, and your progress syncs across the web and the CoddyKit app. The HTML Academy course includes 4 lessons in total.

What Are Live Regions?

A live region is a section of the page whose content updates dynamically. Screen readers monitor live regions and announce changes automatically without the user moving focus.

Creating a Live Region

Add aria-live to a container element:

<!-- Polite: announce when user is idle -->
<div aria-live="polite" id="notifications"></div>

<!-- Inject text to announce: -->
<script>
document.getElementById('notifications').textContent = '5 new messages';
// Screen reader announces: '5 new messages' when user pauses
</script>

aria-live Values Recap

The three levels of aria-live:

  • off — no announcements (default for non-live regions)
  • polite — announce when the user pauses speaking
  • assertive — announce immediately, interrupt current speech

aria-atomic in Depth

aria-atomic controls what is announced when content changes:

<div aria-live="polite" aria-atomic="false">  <!-- default -->
  Items in cart: <span id="count">3</span>
</div>
<!-- Only the changed span is announced: '4' -->

<div aria-live="polite" aria-atomic="true">
  Items in cart: <span id="count">3</span>
</div>
<!-- The entire div is announced: 'Items in cart: 4' -->

<!-- aria-atomic="true" gives more context but is more verbose -->

aria-relevant Values

aria-relevant specifies which DOM changes trigger announcements:

<!-- Default: additions text -->
<div aria-live="polite" aria-relevant="additions text">

<!-- Announce removals too: -->
<div aria-live="polite" aria-relevant="removals">

<!-- Announce everything: -->
<div aria-live="polite" aria-relevant="all">

<!-- Values: additions, removals, text, all
     'additions' = added nodes announced
     'removals' = removed nodes announced
     'text' = text content changes announced -->

Predefined Live Region Roles

Some roles implicitly set aria-live:

  • role="alert" — aria-live="assertive" + aria-atomic="true"
  • role="status" — aria-live="polite" + aria-atomic="true"
  • role="log" — aria-live="polite"
  • role="timer" — aria-live="off"
  • role="marquee" — aria-live="off"

Loading State with Live Region

Announce loading and completion states:

<div role="status" aria-live="polite" aria-atomic="true" id="load-status">
  <!-- empty initially -->
</div>

<script>
async function loadData() {
  document.getElementById('load-status').textContent = 'Loading...';
  const data = await fetchData();
  renderResults(data);
  document.getElementById('load-status').textContent =
    `${data.length} results loaded.`;
}
</script>

Form Submission Feedback

Live region for form submission status:

<form id="contact-form" novalidate>
  <input type="email" name="email">
  <button type="submit">Subscribe</button>
</form>

<div role="status" aria-live="polite" id="form-status"></div>

<script>
form.addEventListener('submit', async (e) => {
  e.preventDefault();
  const status = document.getElementById('form-status');
  status.textContent = 'Submitting...';
  await submitForm(new FormData(form));
  status.textContent = 'Thank you! You are now subscribed.';
});
</script>

Search Results Count

Announce search results dynamically:

<label for="search">Search</label>
<input type="search" id="search">

<div role="status" aria-live="polite" aria-atomic="true" id="results-count"></div>
<div id="results"></div>

<script>
let debounceTimer;
search.addEventListener('input', () => {
  clearTimeout(debounceTimer);
  debounceTimer = setTimeout(() => {
    const results = filterResults(search.value);
    renderResults(results);
    document.getElementById('results-count').textContent =
      `${results.length} results for "${search.value}"`;
  }, 300);
});
</script>

Live Region Anti-patterns

Avoid these live region mistakes:

  • Do not create and destroy live regions — make them persistent with empty initial content
  • Do not put live regions inside aria-hidden areas
  • Do not use assertive for routine updates — it is very disruptive
  • Do not announce updates too frequently (throttle search result counts)

Testing Live Regions

How to test live region announcements:

  • Turn on VoiceOver (Mac: Cmd+F5) or NVDA (Windows: Ctrl+Alt+N)
  • Trigger the update and listen for the announcement
  • Verify timing: polite waits, assertive interrupts
  • Check axe DevTools doesn't flag live region issues

Quick Check

What role implicitly sets aria-live assertive and aria-atomic true?

Recap: Live Regions

Live region essentials:

  • aria-live="polite" — wait for user pause
  • aria-live="assertive" — interrupt immediately
  • aria-atomic="true" — announce whole region
  • role="alert" = assertive + atomic; role="status" = polite + atomic
  • Keep live regions persistent; clear then set content
Free to start

Learn HTML with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
40
Lessons
159

Frequently Asked Questions

Is the “Live Regions aria-live aria-atomic aria-relevant” lesson free?

Yes — any 3 lessons of the HTML Academy learning path, including “Live Regions aria-live aria-atomic aria-relevant”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The HTML Academy course includes 4 lessons in total.

What will I learn in “Live Regions aria-live aria-atomic aria-relevant”?

Announce asynchronous updates to assistive technology. You practise HTML Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start HTML Academy?

No prior experience is required. HTML Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 3 of 4.

How long does the “Live Regions aria-live aria-atomic aria-relevant” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this HTML Academy lesson?

Yes. Every HTML Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. aria-expanded aria-controls for Toggles
  2. aria-selected and Tab Patterns
  3. Live Regions aria-live aria-atomic aria-relevant
  4. Testing with Screen Readers
← Back to HTML Academy