Skip to content

fix(site): stop exposing the empty notifications region to screen readers - #32141

Merged
aqandrew merged 2 commits into
mainfrom
a11y/reading-order-hidden-content
Nov 13, 2026
Merged

aqandrew merged 2 commits into
mainfrom
a11y/reading-order-hidden-content

Conversation

@aqandrew

@aqandrew aqandrew commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Sonner always renders its toast container as <section aria-label="Notifications alt+T" aria-live="polite">. NVDA reads it as an empty "Notifications alt+T region" at the bottom of every page, even when no toast is shown.

This PR upgrades sonner from 2.0.7 to 2.0.8, which adds customAriaLabel, and passes an empty label while there are no toasts. An unnamed section is not a landmark, so screen readers no longer stop on it. It stays a polite live region, so toasts are still announced, and it gets its usual name back while toasts are visible.

Closes DEQ-474
Closes DEQ-497

Ticket UI surface
DEQ-474 Toast container on every page (reported after the footer on /login?redirect=/workspaces)
DEQ-497 Toast container on every page (reported at the bottom of /login)

This changes ARIA only and nothing visible, so there are no screenshots.

The sonner 2.0.8 bump also brings upstream fixes: dismissal and re-creation of toasts with the same ID, bounded toast history, aria-hidden on its default icons (we supply our own), and a data-react-aria-top-layer attribute on the section. The CSS changes in the release apply only to [data-styled=true], and our Toaster is unstyled.

In 2.0.8, a newly mounted Toaster replays every active toast from sonner's module-level store. Without cleanup, toasts from one test or story leaked into the next and duplicated text queries. So site/test/setup/msw.ts (Vitest) and site/.storybook/preview.tsx (a project-level beforeEach) now call toast.dismiss().

Self-review findings left as they are:

  • FE1/TS5, test asserts presence (.not.toBeInTheDocument()) on a role query. The behavior under test is the accessible name, which a screenshot cannot capture. The rest of the file uses the same assertions.
  • useSonner() counts toasts for all toasters and ignores toasterId. The app has one Toaster and nothing sets toasterId, so filtering would be dead code.
  • The name is cleared about 200 ms before the last toast finishes its exit animation. The region uses aria-relevant="additions text", so removals are not announced anyway.
  • {...props} spreads after customAriaLabel, so a caller could override it. No caller passes props, and moving the spread would change precedence for every other prop.
Grouping and decision log
  • The reading-order-hidden-content label has three tickets. DEQ-474 and DEQ-497 report the same element (#root > section, the Sonner container), so they share one root cause and one fix in the shared Toaster wrapper.
  • DEQ-299 (hidden Emoji picker content on the template builder's Customizations step) was already fixed on main. feat(site/src): choose an organization when creating a project #30181 made the pre-warm picker inert and aria-hidden, and feat: replace Emoji Mart with Frimousse in the emoji picker #30526 replaced Emoji Mart. The collapsed popover's content is not mounted. Nothing to change here; noted on the ticket.
  • Options considered for the Sonner region:
    1. Mount <Toaster> only while toasts exist. Rejected: a live region inserted together with its content is often not announced.
    2. A pnpm patch to drop the label on 2.0.7. Rejected because 2.0.8 ships customAriaLabel upstream.
    3. Upgrade and pass customAriaLabel="" while empty. Chosen: smallest change, no patch to maintain.
  • Verified in Storybook (NotificationsInbox/MarkAllAsReadFailure): with a toast, the section is named Notifications alt+T. After closing it, aria-label="" and aria-live="polite" remain, and no region shows in the accessibility tree. axe reports only the existing aria-dialog-name on the popover.
  • The new Vitest test fails on main and passes on this branch.

🤖 Generated by Coder Agents on behalf of @aqandrew.

…ders

Sonner always renders its toast container as a section named
"Notifications alt+T", so screen readers announce an empty region at
the bottom of every page. Upgrade sonner to 2.0.8 for customAriaLabel
and leave the section unnamed while no toast is shown. It remains a
polite live region, so toasts are still announced.
@aqandrew
aqandrew temporarily deployed to main November 12, 2026 22:35 — with GitHub Actions Inactive
@aqandrew
aqandrew temporarily deployed to main November 12, 2026 22:35 — with GitHub Actions Inactive
@linear-code

linear-code Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

DEQ-497

DEQ-474

sonner 2.0.8 replays active toasts to a newly mounted Toaster, so toasts
from one test or story leaked into the next and duplicated text queries.
@aqandrew
aqandrew temporarily deployed to main November 12, 2026 22:59 — with GitHub Actions Inactive
@aqandrew
aqandrew temporarily deployed to main November 12, 2026 23:00 — with GitHub Actions Inactive
@aqandrew
aqandrew marked this pull request as ready for review November 12, 2026 23:09
@aqandrew
aqandrew temporarily deployed to main November 12, 2026 23:10 — with GitHub Actions Inactive
@aqandrew
aqandrew merged commit 7ef8d90 into main Nov 13, 2026
37 checks passed
@aqandrew
aqandrew deleted the a11y/reading-order-hidden-content branch November 13, 2026 21:06
@aqandrew
aqandrew temporarily deployed to main November 13, 2026 21:06 — with GitHub Actions Inactive
@aqandrew
aqandrew temporarily deployed to docs-preview November 13, 2026 21:06 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 13, 2026

This branch was previously deployed

2 inactive deployments
main — 46a42bb9 Deployed Nov 13, 2026 by aqandrew via cla #257013
docs-preview — 46a42bb9 Deployed Nov 13, 2026 by aqandrew via cleanup #59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants