Skip to content
easeweb
Search topics

Toasts that vanish before you can read or undo them

A "Message deleted" toast holds the only Undo and removes itself after four seconds, so anyone slower to reach it loses the action.

WCAG 2.2
SC 4.1.3AA· new in 2.1SC 2.2.1A
Required by
Section 508 · EN 301 549 (EU)
Broken
Gone in four seconds.
The accessibility problem illustrated.
01

The problem

People who read, move or find things more slowly lose the only way to undo a deletion, because the toast that holds it removes itself after four seconds.

02

Try it

Delete a message, then try to undo it.

Use Tab and Enter, and take your time. Can you still reach Undo?

Broken Can you fix this?

  • Lunch on Friday
  • Invoice for March
  • Team photos
  • Weekly report

Screen reader says: (Delete a message)

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Keep an action people may need until they are done with it, or keep it somewhere it lasts.

  1. 1Don't remove a message that holds the only way to do something; leave it until it is dismissed, or keep the action somewhere it lasts.
  2. 2Announce the message from a status region that was already there, or by moving focus to its action when the control pressed is gone.
  3. 3Don't take a message away while it is hovered or focused.
Before An Undo toast that closes after four seconds
<ul id="inbox">  <li>Lunch on Friday <button type="button" class="delete">Delete</button></li>  <!-- … --></ul><div id="toasts" class="toasts" role="status"></div>
After

A toast that stays until it is closed

<ul id="inbox">  <li>Lunch on Friday <button type="button" class="delete">Delete</button></li>  <!-- … --></ul><!-- Straight after the list, so Tab reaches it soon --><div id="toasts" class="toasts" role="status"></div>

Fixing this with an AI coding assistant? Get this guide as Markdown

04

Verify the fix

4 checks, no mouse.

Test with: Screen reader, Keyboard, Zoom

0 of 4 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the toast component or the delete flow changes.

Limits

This covers one kind of message, the confirmation of an action that can be undone. Errors, alerts that need an answer, and notifications from other people are topics of their own, and so is making sure the announcement is heard at all (see "Status messages that are shown but never announced"). Live regions and focus behave differently across screen readers and browsers. Test your real messages, at the pace your users work.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

Keep this fixed as your code changes.

Turn guides like this into rules your coding agents and CI follow, then have the result retested with a keyboard and screen readers.

How retests work