Dialogs, live regions, toasts and tooltips
What an accessible modal must do, how aria-live polite and assertive announce changes, role=status and role=alert, toasts that never steal focus and can be paused (WCAG 2.2.1), and tooltips that stay open on hover and focus (1.4.13).
Comes up in: Web fundamentals, Machine coding
Learn#
Shreya’s app shows “Saved” toasts in the corner. Screen-reader users never hear them, and the toasts vanish in 3 seconds, before some users can read them.
A live region is an element whose changes screen readers announce without moving focus. aria-live="polite" waits until the user is idle; aria-live="assertive" interrupts. A status message, such as “Saved” or “3 results”, uses role="status" (polite). Urgent problems use role="alert" (assertive):
<!-- Present on page load and empty, so later changes are announced -->
<div role="status" class="toasts"></div>
<div role="alert" class="errors"></div>Add text inside them later, and screen readers read it.
Toasts must not steal focus, and users must be able to pause or extend timed content (WCAG 2.2.1): pause on hover and focus, and give important ones a close button instead of a timer.
Page
- <div role=status>Saved</div>
Console
empty
State
empty
The user saves a form. A toast "Saved" appears in the corner. Focus stays where it was.
Read the steps as text
- The user saves a form. A toast "Saved" appears in the corner. Focus stays where it was.
- The toast container is a live region (role="status", which is polite). The screen reader finishes its sentence, then says "Saved".
- A payment fails. That toast uses role="alert" (assertive), so it interrupts and is read at once.
- The user moves the mouse onto the toast: its timer pauses, so slow readers are not rushed. It resumes when the mouse leaves.
Predict#
Predict first
You create a new div with role="status" and the text "Saved", and insert it into the page at the same moment. Is it reliably announced?
Many screen readers announce changes to a live region they already know about. A region added together with its text may be missed. Keep the container in the page from the start and insert messages into it.
Interview angle#
Say it like this — about 30 seconds
“aria-live marks a region whose changes are announced without moving focus. Polite waits for the screen reader to finish, so I use it for most updates, like saved messages and result counts, often through role status. Assertive interrupts, so I use it only for urgent errors, often through role alert. The region must exist before content is added. Toasts should not steal focus and should pause on hover and focus. A modal dialog needs focus moved in, contained and restored, Escape to close, and an accessible name.”
Follow-up What is aria-live, and when do you use polite vs assertive?
Follow-up How do you make a custom modal accessible?
Follow-up What does WCAG 1.4.13 require of tooltips?
Practice#
Guided
Build an accessible toast queue: polite and assertive announcements, pause and resume, and expiry.
Done when
- Status toasts are announced politely, alerts assertively, and alerts never expire on their own.
- Paused time does not count toward expiry.
tickremoves expired toasts;dismissremoves one by id.
Remember#
Try to answer each card before you open it. Then add them to your reviews.
aria-live polite vs assertive?
Polite waits until the user is idle; assertive interrupts.
Which role fits a "Saved" message?
role="status" (polite).
Why must a live region exist before its message?
Screen readers announce changes to regions they already track.
What three things does WCAG 1.4.13 require of tooltips?
Dismissible, hoverable, persistent.
Go deeper
Four layers. Stop at the one your interview needs; each ends with a quick check.
The core ideaEvery round
role="status" implies polite and role="alert" implies assertive. Keep messages short; screen readers read the whole changed text.Check yourself: Does a live region move focus?
No. It announces changes without moving focus.
How it works underneathSenior rounds
<dialog> with showModal() does most of this (WEB.07.02) Source: WAI-ARIA APG: Dialog (modal) pattern.Check yourself: Which native element handles most modal requirements?
dialog with showModal().
Edge cases and trapsWhere people slip
aria-describedby, and must stay while the pointer is over it and close on Escape (WCAG 1.4.13). Interactive content belongs in a popover, not a tooltip.Check yourself: Can a tooltip contain a link?
No. Tooltips hold short text only; use a popover or dialog for interactive content.
In productionStaff-level answers
Toasts with actions such as Undo should stay until dismissed and be reachable by keyboard; consider a fixed notification area. Pause timers on hover and focus (WCAG 2.2.1) Source: WCAG 2.2: Understanding Timing Adjustable.
Check yourself: How should a toast with an Undo action behave?
Stay until dismissed (or be easy to reach), and let users reach the button by keyboard.
Finished the five steps? Mark it, and its cards join your reviews.
Last checked 2026-11-01. Spot a mistake? Use “Report an error” below — fixes are listed on the corrections page.
Interview questions this answers
- What is
aria-liveand when do you use polite vs assertive? - How do you make a custom modal accessible?