NTF-34Recommended
Announce new items without stealing focus
Announce new notifications to screen readers through a polite live region, and never move focus or open a dialog for them.
How to do it
Use the live region from announce changes without moving focus. Write one short line per batch, such as "2 new notifications", never one line per item. Give the bell button a name that includes the unread count. Toasts stay until closed or pause on hover and focus, as in give people enough time. Critical items stay in the inbox after the toast goes.
Examples
HTML example
<button type="button" class="inbox-bell" aria-expanded="false" aria-controls="inbox-panel">
Notifications <span class="inbox-count">3 unread</span>
</button>
<p role="status" class="visually-hidden" id="inbox-announcer"></p>
How to check
Run axe-core on the page with the inbox open and closed, and get zero violations. A browser test creates a notification and finds its text in the role="status" element, while document.activeElement stays where it was.
Sources
Related rules
- AXS-30 Announce changes without moving focus in Accessibility
- AXS-36 Give people enough time in Accessibility
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/notifications/in-app-notifications/accessible-inbox">Agent Wranglers notifications playbook</a>. In code you write, add a comment next to it with the same link.