Skip to content

fix: prevent duplicate toast announcements - #1292

Open
wanxiankai wants to merge 1 commit into
fkhadra:mainfrom
wanxiankai:fix/toast-live-region-announcements
Open

fix: prevent duplicate toast announcements#1292
wanxiankai wants to merge 1 commit into
fkhadra:mainfrom
wanxiankai:fix/toast-live-region-announcements

Conversation

@wanxiankai

Copy link
Copy Markdown

Summary

  • remove the redundant live-region attributes from ToastContainer
  • keep each toast's configurable role as the single announcement source
  • add a regression test that prevents toast live regions from being nested

Fixes #1291

Why

ToastContainer used aria-live="polite" while each toast defaults to
role="alert". Since alert is itself a live region, this nested live-region
structure caused NVDA to announce the same toast multiple times and announce it
again when it was removed.

Removing the container's live-region attributes avoids the duplicate
announcements without changing toast roles, custom role overrides, the
container's accessible label, or keyboard navigation.

Test plan

  • pnpm build
  • pnpm exec prettier --check src/components/ToastContainer.tsx src/tests.cy.tsx
  • pnpm exec cypress run --component -b chrome --spec 'src/**/*.cy.tsx,packages/**/*.cy.tsx' (70 passing, 7 existing pending)
  • Playground: verified one role="alert" toast with no aria-live ancestor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant