November 2026 - Data Table Announcements
Data Table reads its result count to screen readers, and Data Grid announces sorting, row selection, cell edits, pastes, undo and redo. Includes breaking changes.
Filtering a Data Table, or sorting, selecting, editing, pasting and undoing in a Data Grid, changes what's on screen without moving focus. Screen reader users now hear what changed. This release has breaking changes for installed grids, the pager's status, and tests.
Breaking changes
-
The grid needs a new file.
use-data-grid.tsimportslib/data-grid-announcer.ts. Reinstall the Data Grid to get it.npx shadcn@latest add "@diceui/data-grid" -
The menus need the latest Sortable. The sort and filter menus of both components pass
getItemLabeltoSortable. Let the reinstall overwriteui/sortable.tsx, or reinstall it.npx shadcn@latest add "@diceui/sortable" -
The grid announces by default. It speaks through a live region on
document.body. Return an empty string from a message to silence it.useDataGrid({ data, columns, messages: { sorted: () => "" }, });In tests, remove the live region after each test.
import { destroyAnnouncer } from "@/lib/data-grid-announcer"; afterEach(() => { cleanup(); destroyAnnouncer(); }); -
The pager's page text is no longer a status.
DataTablePagination's "Page 2 of 5" lost itsrole="status", so a filter isn't announced twice, andDataTablerenders a visually hidden status with the result count. Tests that read the page from a status should read the result status.const status = screen.getByText("Page 2 of 5", { selector: "[role=status]" }); const status = await screen.findByText("42 results, page 2 of 5", { selector: "[role=status]", });The pager keeps its status for the selection count, so a table renders two statuses, and the result status updates 500ms after the table settles.
Data Table
- Result count. The table reads its result count once it has stayed the same for 500ms, with the page when there's more than one: "42 results", "42 results, page 2 of 5", "1 result" or "No results". A server table without
rowCountreads "Page 2 of 5", or "Page 2" without a page count. Typing a search is announced once, and paging still is. - Selection count. The pager reads its selection count once per change, where "1 row selected." used to be read twice.
- Sort and filter menu drags. Dragging a sort or filter announces the column label instead of its id, once per position, and Escape cancels the drag without closing the menu.
Data Grid
-
Announcements. The grid announces sorting ("Sorted by Name, ascending" or "Sorting cleared"), row selection ("Row 3 selected", "All rows selected"), and edited or cleared cells ("Name updated", "5 cells updated"). An edit is announced once when editing ends, and not at all when the value ends where it started.
-
Pastes, undo and redo. A paste is announced once with its counts ("4 cells pasted", "4 cells pasted, 1 skipped, 2 rows added"), and undo and redo name the change they reverse ("Undo: Name updated", "Undo: 2 rows deleted"). Their toasts stay visible but are hidden from screen readers, so each is spoken once. The undo and redo toasts now read "Action undone" and "Action redone".
-
Custom messages.
useDataGridtakesmessagesto replace any of these strings, for example to translate them. The keys aresorted,rowSelected,rowDeselected,rowsSelected,allRowsSelected,cellsEdited,cellsPasted,rowsAdded,rowsDeleted,undoneandredone.useDataGrid({ data, columns, messages: { rowSelected: (rowNumber) => `Fila ${rowNumber} seleccionada`, cellsEdited: (count, columnLabel) => count === 1 && columnLabel ? `${columnLabel} actualizado` : `${count} celdas actualizadas`, }, }); -
Search count. The search's match count, like "2 of 44", is read once per change.
-
Sort and filter menu drags. Dragging a sort or filter announces the column label, once per position, like the Data Table.
Migrating
- Reinstall the Data Table and Data Grid components you use, and let them update
ui/sortable.tsx. - Pass
messagestouseDataGridto change or silence its announcements. - Call
destroyAnnouncer()in the teardown of tests that render a Data Grid. - Update tests that read "Page x of y" from a status to read the result status instead.