TL;DR: Semantic <table> markup with <th scope> gets you 90% of the way to an accessible data table, with zero ARIA. Reach for the ARIA grid pattern only when individual cells become independently interactive, such as inline editing or spreadsheet-style arrow-key navigation. Sortable columns need aria-sort plus a live-region announcement; large virtualized datasets need special care.
Open almost any SaaS product and you're looking at a data table. Usage dashboards, billing history, user-management screens, admin panels: the default surface of a SaaS application is dense, sortable, filterable rows of data, not marketing copy. That makes table accessibility one of the highest-leverage things a product team can get right, because it's not an edge case buried three clicks deep; it's the screen people spend most of their day looking at. Teams building this kind of interface professionally tend to lean on a SaaS development team at YuSMP precisely because dashboard accessibility compounds across every screen in the product, not just one.
The good news is that most of the work is boring, in the best way: start with real <table> markup, and the browser does the heavy lifting. ARIA only enters the picture for the subset of tables that behave more like a spreadsheet than a document. This piece covers both paths: when to stay with semantic HTML, when to reach for role="grid", and the specific details (live announcements, multi-level headers, virtualized rows) that most "sortable table" tutorials skip.
Before writing a single aria-* attribute, build the table out of real table elements: <table>, <thead>, <tbody>, and <th scope="col"> or scope="row" on every header cell. This alone satisfies WCAG 1.3.1 (Info and Relationships) and 1.3.2 (Meaningful Sequence) for static, read-only data. The browser's accessibility tree already knows that a <th> labels the column beneath it, with no annotation from you required.
<table>
<caption>Invoices — last 30 days</caption>
<thead>
<tr>
<th scope="col">Invoice</th>
<th scope="col">Customer</th>
<th scope="col">Amount</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">INV-1042</th>
<td>Acme Co.</td>
<td>$480.00</td>
<td>Paid</td>
</tr>
</tbody>
</table>A screen reader user navigating this table hears "Invoice, column header," then can jump cell to cell with the row and column announced automatically. No JavaScript, no roles, no labels, just correct markup doing what it was designed to do.
The trigger isn't "the table looks complex": it's cell-level interactivity. A table where you read values is a table. A table where you tab into a cell, edit its contents, and arrow-key to the next one is behaving like a spreadsheet, and that's what role="grid" exists for. The W3C ARIA Authoring Practices Guide's grid pattern defines exactly this: a two-dimensional widget where focus moves between cells with arrow keys, not just Tab.
If your rows are read-only, even if they're sortable and filterable, stay with semantic <table> markup. Sorting and filtering change which rows are visible; they don't make the cells themselves interactive. Reserve the grid pattern for inline-editable spreadsheets, kanban-style data entry, or any UI where arrow keys need to move focus across a 2D cell layout.
role="table": same semantics as a native <table>, useful only if you're stuck rendering divs for layout reasons and need to restore the lost structure.role="grid": adds the expectation that cells are focusable and that arrow keys, not just Tab, move between them.Set aria-sort on the active header, with a value of ascending, descending, or none:
<th scope="col" aria-sort="ascending">
<button>Name ↑</button>
</th>aria-sort updates the accessibility tree, but most screen readers won't proactively announce that change unless focus happens to land back on the header, and after clicking a sort button it usually doesn't. The fix most tutorials skip is a live region that speaks the change out loud:
<div aria-live="polite" class="sr-only" id="sort-status"></div>
<script>
function announceSortChange(column, direction) {
const status = document.getElementById('sort-status');
status.textContent = `Table sorted by ${column}, ${direction}`;
}
</script>Clear and reuse the same live region on every sort event rather than creating a new one each time. A stable region is what most screen readers reliably pick up and announce.
Once a grid has interactive cells, Tab alone is the wrong model: tabbing through every cell in a 50-row table is unusable. The standard pattern is roving tabindex: exactly one cell in the grid has tabindex="0" at any time, every other cell has tabindex="-1", and arrow keys move the 0 to the next cell while calling .focus() on it.
grid.addEventListener('keydown', (e) => {
const current = document.activeElement;
let next;
if (e.key === 'ArrowRight') next = current.nextElementSibling;
if (e.key === 'ArrowLeft') next = current.previousElementSibling;
if (e.key === 'ArrowDown') next = getCellBelow(current);
if (e.key === 'ArrowUp') next = getCellAbove(current);
if (!next) return;
current.setAttribute('tabindex', '-1');
next.setAttribute('tabindex', '0');
next.focus();
e.preventDefault();
});This keeps the grid a single Tab stop from the outside. Tab moves past the whole grid in one step, and arrow keys do the work inside it, matching how a real spreadsheet behaves.
scope="col" breaks down once a table has grouped or nested column headers, say "Q1" spanning three sub-columns for "Revenue," "Cost," and "Margin." A single scope value can't express "this cell belongs to both the Q1 group and the Revenue sub-column." The fix is explicit association with headers and id:
<th id="q1">Q1</th>
...
<th id="q1-rev" headers="q1">Revenue</th>
...
<td headers="q1 q1-rev">$482,000</td>Every data cell lists the ids of every header that applies to it, in order from most general to most specific. It's more markup than scope, but it's the only mechanism that correctly expresses a two-level header hierarchy to assistive technology.
Row virtualization, which renders only the rows currently in the viewport and swaps DOM nodes as the user scrolls, is standard for tables with thousands of rows, and it actively fights table accessibility. A screen reader builds its sense of table size from aria-rowcount and aria-rowindex: if virtualization removes rows 1–40 from the DOM while the user is on row 60, and those attributes aren't kept in sync, the table appears to shrink and renumber itself mid-navigation.
The mitigation is to set aria-rowcount on the table to the full logical row count (not just what's rendered), and aria-rowindex on each rendered row to its true position in the full dataset, not its position among the currently-mounted DOM nodes. Done correctly, a screen reader reports "row 847 of 12,000" accurately even though only 20 rows exist in the DOM at that moment.
A bar chart or line graph is, underneath the visual, a table of numbers rendered as shapes, and shapes alone carry no accessible data. The most reliable fix for chart accessibility isn't a elaborate ARIA chart role; it's pairing the visualization with a visually-hidden (or toggleable) <table> containing the same data the chart draws from. Screen reader users get the real numbers through markup that already works; everyone else gets the chart. This is also the cheapest way to make a dashboard's data exportable and testable, which a pile of SVG paths never is on its own.
aria-sort changes are actually announced, not just present in the DOM.aria-rowcount/aria-rowindex stay accurate while scrolling.No. A plain <table> with <thead>, <tbody>, and <th scope> already carries the role, name, and relationship information a screen reader needs for static data. ARIA roles like grid only earn their place when cells themselves become independently interactive.
role="table" describes read-only tabular data with the same semantics as a native <table>. It is useful only when you're forced into non-table markup for layout reasons. role="grid" additionally tells assistive technology that cells are focusable and interactive, enabling two-dimensional keyboard navigation that plain tables don't support.
Set aria-sort="ascending" or aria-sort="descending" on the active <th>, and separately push a short message, like "Table sorted by Name, ascending," into an aria-live="polite" region. aria-sort alone updates the accessibility tree silently; most screen readers won't announce it unless focus happens to land back on that header.
Partially. Most component libraries render semantic table markup and basic ARIA attributes correctly, but sort-state live announcements, keyboard navigation for interactive cells, and multi-level header associations are usually left to the implementer. Check the library's accessibility docs for the specific component rather than assuming the whole surface is covered.
Level AA is the practical floor for most organizations and the level most legal and procurement standards reference. For tables specifically, that means satisfying 1.3.1 Info and Relationships, 1.3.2 Meaningful Sequence, 2.1.1 Keyboard, and 4.1.3 Status Messages if you add live sort or filter announcements.
Use what's already on your machine: VoiceOver (Cmd+F5) on macOS, or NVDA (free download) on Windows. Turn it on, unplug your mouse, and try to read a row, sort a column, and reach a specific cell using only Tab, arrow keys, and the screen reader's table-navigation shortcuts. If you can't do it blind, a screen reader user can't either.
You can, but only if you fully replicate the ARIA grid or table role structure: role="table", role="row", role="columnheader", role="cell" on every level, by hand. Native <table> markup gives you all of that from the browser's parser for free. Div soup styled to look like a table, without the roles, is invisible to assistive technology no matter how it looks.