Files
coder/site/test
Andrew Aquino 7ef8d90c2b fix(site): stop exposing the empty notifications region to screen readers (#32141)
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.

<details>
<summary>Grouping and decision log</summary>

- 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. #30181 made the pre-warm
picker `inert` and `aria-hidden`, and #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.

</details>

🤖 Generated by Coder Agents on behalf of @aqandrew.
2026-11-13 13:06:12 -08:00
..