Search topics
Data tables with headers that are only bold text
The header row is styled to look like headers, but every cell is a td, so nothing ties a value to its row or column.
<td> The problem
Screen reader users hear numbers without knowing which row or column they belong to
A pricing page compares plans in a table. The top row reads Plan, Monthly and Yearly in bold, and each row below starts with a plan name. A sighted reader glances up and left to see what a figure means. A screen reader user moving through the cells hears "$12", "$120", "$30", "$300", and nothing else. To learn that "$30" is the Team plan's monthly price, they have to move back to the top of the column and to the start of the row, and keep both in mind.
Every cell is a td. The header row is bold because of a class, and the plan names are bold because of a style on the first column. Bold is a visual relationship; it is not in the markup. WCAG 1.3.1 Info and Relationships requires that structure shown visually is also available in code, and in a data table the main structure is which header applies to which cell. With no th and no ARIA header roles, the browser has nothing to pass on, so screen readers cannot announce headers with each value.
The table is small here, and counting back is only tiring. In a timetable, a results table or a comparison with a dozen columns, the person has to rebuild the grid from memory, and a single slip gives them the wrong price or the wrong time.
1 of 10 groups affected
- No vision (affected)
- Low vision (not affected)
- Colour vision (not affected)
- No hearing (not affected)
- Hard of hearing (not affected)
- No speech (not affected)
- Motor (not affected)
- Reach, strength (not affected)
- Cognitive (not affected)
- Seizures (not affected)
- Without vision A screen reader moving through the table reads each value alone, so "30" could be any plan and any billing period until the person goes back to the top row and counts across.
A scanner can say that a table has no th, but not which cells ought to be headers, and some tools stay quiet when a table has a th that heads the wrong thing. axe's td-has-header, which reports data cells with no header in a table larger than 3 by 3, is an experimental rule that many scans don't run. It cannot tell whether scope points the right way, or whether a header row that sorting rebuilt still matches the data. AI code generators often produce a grid of div elements styled as a table, or add role="table" without the row and cell roles under it. Only reading the table with a screen reader, cell by cell, confirms that each value is announced with the headers a sighted reader would use.
What the checkers report
- axe DevTools
- Table header text should not be empty
- scope attribute should be used correctly
- Non-empty <td> elements in larger <table> must have an associated table header
- Table cell headers attributes must refer to other <th> elements in the same table
- Table headers in a data table must refer to data cells
- Lighthouse
- Cells in a
<table>element that use the[headers]attribute refer to an elementidnot found within the same table. <th>elements and elements with[role="columnheader"/"rowheader"]do not have data cells they describe.
- Cells in a
- WAVE
- Empty table header
Try it
Press Tab to move through the prices
Each Tab stands in for a screen reader moving to the next cell. The panel shows what it announces. Can you tell what each price is for?
Broken Can you fix this?
| Plan | Monthly | Yearly |
| Starter | $12 | $120 |
| Team | $30 | $300 |
The fix
Mark header cells as headers, and say which way each reads
<table class="prices"> <tr class="head"> <td>Plan</td> <td>Monthly</td> <td>Yearly</td> </tr> <tr> <td class="plan">Starter</td> <td>$12</td> <td>$120</td> </tr> <tr> <td class="plan">Team</td> <td>$30</td> <td>$300</td> </tr></table>What is wrong3 points
- A screen reader announces "$30" alone, with neither its plan nor whether it is monthly or yearly.
- The headers are headers only to the eye: the
headandplanclasses only make the text bold. - Nothing says which header applies to which cell. Every cell is a
td, so every cell is data.
Th with scope
<table class="prices"> <thead> <tr> <th scope="col">Plan</th> <th scope="col">Monthly</th> <th scope="col">Yearly</th> </tr> </thead> <tbody> <tr> <th scope="row">Starter</th> <td>$12</td> <td>$120</td> </tr> <tr> <th scope="row">Team</th> <td>$30</td> <td>$300</td> </tr> </tbody></table>How it is fixed3 steps
- Make each header a
th, with the header row in atheadand the rest in atbody. - Give each
thascopethat says whether it heads its column or its row. A screen reader now announces "Team, Monthly, $30" on that cell, and when the person moves down a column it repeats only the row header that changed. - Remove the
headandplanclasses:this bold by default.
This fixes the Before and passes 1.3.1. Of the extras the ARIA roles are kept for below, a real table takes sortable columns, with the button and aria-sort on its th, and aria-rowcount too.
Why this fix: Use native HTML first
All three pass 1.3.1 on this table. Use th with scope: it does the same job as the other two with the least code, needs no ids to keep in step, and works in every screen reader and browser reading mode. Reach for headers and id only when the table is irregular enough that scope cannot say which headers apply, and for the ARIA roles only when the markup cannot be a table. In that case, check every role is in place, since a missing one silently breaks the grid.
Several things change how a header row behaves after the markup is right.
thwithoutscope: browsers infer the direction in a simple table with one header row, but addingscopecosts nothing and holds when someone later adds a row header.- Responsive tables: CSS that sets
display: blockorgridon table elements can remove their table semantics in some browsers. Test the narrow layout with a screen reader, or keep the table and let it scroll inside a named, focusable region. - Sorting and filtering: a sort that rebuilds the body must keep the row
th. Say which column is sorted witharia-sort, as in sortable tables that show the sort only as an arrow. - Layout tables: a table used only to place content should not have
thorcaption. Give itrole="presentation", or better, replace it with CSS layout, as in layout tables read as data tables, or out of order.
A caption names the table so that people moving between tables can tell them apart. It is covered by its own guide, tables with a title but no caption, but it belongs in the same component.
Verify the fix
5 checks, no mouse.
Test with: Screen reader, Keyboard, Zoom
Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the table component changes.
Limits
This is a starting pattern, not a guarantee for every table. Screen readers differ in how much header text they repeat and when. Tables with headers several levels deep can be hard to follow even with perfect markup; where the data allows, split them into simpler tables. A table whose cells people change is a different widget, covered in editable data grids a keyboard can't move through or edit. Headers only give a cell its context: a cell that shows its value as an icon also needs the value in words, as in comparison tables with ticks and crosses that read as blank.
This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.
EaseWeb service
Fixed it? Keep it from coming back.
I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.