Skip to content

feat(data-grid): announce pastes to screen readers - #1329

Merged
sadmann7 merged 3 commits into
mainfrom
sadman/data-grid-paste-announcements
Nov 28, 2026
Merged

sadmann7 merged 3 commits into
mainfrom
sadman/data-grid-paste-announcements

Conversation

@sadmann7

Copy link
Copy Markdown
Owner

A paste changed the grid without a word to screen reader users beyond the toast. The toast couldn't be translated and didn't say what was skipped or added. This is the paste half of #1326; undo and redo are in #1327.

  • Announce each paste once through the grid's announcer with a new cellsPasted key in messages, for example "4 cells pasted", "1 cell pasted, 1 skipped" or "3 cells pasted, 2 rows added". An empty string silences it.
  • Count only the cells a paste wrote, so a cut-paste no longer counts the source cells it clears.
  • Add paste (cellCount, addedRowCount, skippedCount) to a successful paste's ClipboardNotice. The grid announces from it, and a custom onClipboardNotice can check it to skip its own spoken message, since the grid now announces pastes even when that handler is set.
  • Keep the default paste toast visible but leave its text out of screen readers with toastSilently, the same helper feat(data-grid): announce undo and redo to screen readers #1327 adds for undo and redo. Error toasts, such as a paste that skipped every cell, are still read.
  • Add unit tests for the messages, skipped cells, cut-paste and silent toasts, plus an a11y test that pastes with the keyboard in both bases. It checks that the virtual screen reader speaks the announcement and that Chromium's accessibility tree exposes its text once.

The virtual screen reader also logs the hidden toast text, because it falls back to textContent for live region additions, so the a11y test reads Chromium's tree to rule that copy out. Only the toast's title is hidden: an app that turns on sonner's closeButton still has "Close toast" inside the live region.

@vercel

vercel Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tablecn Ready Ready Preview Nov 28, 2026 2:45pm UTC

Request Review

…e-announcements

# Conflicts:
#	e2e/a11y.spec.ts
…e-announcements

# Conflicts:
#	e2e/a11y.spec.ts
#	src/hooks/test/use-data-grid.test.tsx
#	src/lib/data-grid-announcer.ts
@sadmann7
sadmann7 merged commit 46cc248 into main Nov 28, 2026
8 checks passed
@sadmann7
sadmann7 deleted the sadman/data-grid-paste-announcements branch November 28, 2026 14:50

This branch was successfully deployed

1 active deployment
Preview — 986b1e64 Deployed Nov 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant