How do ARIA live regions announce dynamic content?
Live regions announce content that changes without a page reload, such as form errors, toast messages, search result counts or a chat log. The aria-live attribute has values off, polite, which is announced when the user is idle, and assertive, which interrupts immediately and should be used sparingly. Two shortcut roles exist: role="status" is polite and role="alert" is assertive.
<div role="status" aria-live="polite">3 results found</div>
<div role="alert">Your session has expired</div>
The region must exist in the DOM before the content changes. Injecting a new element that already contains text is often not announced, so create the empty container on load and update its contents.
Use aria-atomic="true" to read the whole region rather than just the changed node, and aria-relevant to control additions and removals. Keep announcements concise, avoid announcing on every keystroke, and provide a visually hidden status element when needed. Always verify with a real screen reader.