QuizNot attempted
Announcing a toast
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- Render toasts inside a container with
aria-live="polite"(orrole="status") that exists before the message is inserted
- A live region (
aria-live="polite"orrole="status") makes screen readers announce content changes inside it, and it must already exist in the DOM before the text is inserted or the change isn't noticed. - Not focusing the toast: steals focus and disrupts what the user was doing.
- Not alert(): blocks the page and is a jarring modal for a success message.
- Not aria-hidden=false: a no-op, the toast was never hidden from the a11y tree, it just wasn't announced.