Web Accessibility & WCAG (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What are ARIA Live Regions (`aria-live="polite"` vs. `aria-live="assertive"`)?
senior LevelCode ExampleSystem Design
In Simple Words:
When content updates dynamically via JavaScript (e.g., "Item added to cart" toast or real-time chat message), sighted users see it, but screen readers are unaware.
aria-live announces dynamic DOM changes:
aria-live="polite"(Standard): Screen reader waits until the user finishes reading their current sentence before announcing the update. (Use for success toasts, shopping cart counts).aria-live="assertive"(Urgent): Screen reader interrupts the user immediately mid-sentence. (Use only for critical alerts, payment failures, or countdown timers).
html
<div aria-live="polite" aria-atomic="true" class="toast-container">
Item successfully added to cart.
</div>