Skip to content

TBL-004 Give every data table a visible title and tie it to the table in code

Level
Guideline, our choice
Verdict
Insufficient evidence (1 of 3 judges spoke)
Area
Tables
Status
proposed, version 1.0.0

Rule

Give every data table a visible title that says what its rows have in common. Tie that title to the table in code, as its caption or through aria-labelledby.

Examples

Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.

Do: Each table is titled by its caption

Stock below reorder level
ItemOn handReorder levelSupplier
Pallet wrap1420Northline
Box cutters612Harbour Supply
Strapping915Northline
Deliveries expected this week
SupplierDuePallets
NorthlineTuesday4
Harbour SupplyWednesday2
Keel PackagingWednesday6
Two tables, each with its title in a caption shown above it. The note under them lists the tables the way a screen reader would: each is announced by what it holds. This is our own choice, not something the judges decided.

Do: A heading above the table, tied to it

Deliveries expected this week

Counted at 06:00 · Showing 5 of 5 deliveries

SupplierDuePallets
NorthlineTuesday4
Harbour SupplyWednesday2
Keel PackagingWednesday6
NorthlineThursday3
Keel PackagingFriday5
The title is a heading, and the table points to it with aria-labelledby. “Counted at 06:00” is tied as its description. Choose a supplier: the title stays and the count line says how many rows are shown, without moving focus.

Don't: A heading with nothing tying it to the table

Stock below reorder level

ItemOn handReorder levelSupplier
Pallet wrap1420Northline
Box cutters612Harbour Supply
Strapping915Northline
The heading is there and meets the law's ask, but nothing in the code ties it to the table. A list of the page's tables gives “table”, and on a page with two such tables a person cannot tell them apart.

Don't: A name that differs from the title

Stock below reorder level

ItemOn handReorder levelSupplier
Pallet wrap1420Northline
Box cutters612Harbour Supply
Strapping915Northline
The table has an aria-label, “Inventory grid”, under the visible title Stock below reorder level. A screen reader says one name, the screen shows another, and a person who searches for the visible words does not find it.

Why

A table without a title starts with its headings, and the person has to read a few rows to work out what it is about. With two tables on a page, they also have to work out which one they are in. A screen reader user often lists the tables on a page or jumps from one to the next; without a name, each one is announced as just "table".

No WCAG criterion asks that a table has a title. When it has one, WCAG 2.2, 1.3.1 Info and Relationships asks that the title is in code as what it looks like, such as a heading or a caption. A heading just above the table already meets that. Using the title as the table's name, with the caption element as in H39 or with aria-labelledby, is part of our guideline, not something the criterion asks. 2.4.6 Headings and Labels asks that a title, once there, describes what it heads. 4.1.2 Name, Role, Value and LAY-001 ask for a name on a scroll area that takes focus; the same title can name it.

Our reasons

Only Carbon of the three judges has spoken, so the verdict is Insufficient evidence (1 of 3 judges spoke), and this guideline is our choice. Carbon supports it, and so does GOV.UK, an expert witness who does not vote. Asking for a title on every data table, and not only tying one where it exists, is our choice too. We make it for three reasons.

  • One set of words serves everyone. The title a sighted person reads above the table is the name a screen reader says on arrival. Nobody has to keep a hidden name and a visible one in step.
  • Tables can be told apart. In a list of the page's tables, each one says what it holds, so the person can go straight to the one they want.
  • It costs little. The page usually has a heading over the table already. Tying it in code is one attribute.

Do

  • A warehouse dashboard has two tables. The first has the title Stock below reorder level, put in shadcn's TableCaption. The second has the title Deliveries expected this week. A screen reader's list of tables then reads both titles.
  • shadcn's Table places the caption under the table in muted text. To use it as the title, show it above the table, for example with className="caption-top mt-0 mb-2 text-left text-base font-semibold text-foreground" on TableCaption.
  • When the title is already a heading above the table, such as an h2 with id="deliveries-title" inside CardTitle, give the Table aria-labelledby="deliveries-title" instead of a second, matching caption. The heading markup itself follows STR-002a.
  • When a table is the only content of the page Returns waiting for inspection, the page's h1 can be its title through aria-labelledby. No second visible title is needed.
  • Keep a short note such as "Counted at 06:00" next to the title. Our own choice: tie it to the table as a description with aria-describedby, or put it in the caption after the title.
  • When a filter narrows the rows, keep the title and show a line such as "Showing 12 of 230 items" next to it. If that line changes while focus stays on the filter, announce it as FBK-004 says.
  • When the table sits in its own scroll area under LAY-001, use the same title to name that area, for example with role="region", tabIndex={0} and aria-labelledby. shadcn's Table passes its props to the table, not to its scroll wrapper, so add these in your copy of table.tsx or on an outer wrapper.

Don't

  • Show Stock below reorder level as a heading above the table with nothing in code that ties the two.
  • Give the table an aria-label that differs from the visible title, such as "Inventory grid" under the heading Stock below reorder level.
  • Give two tables on one page the same title, so they cannot be told apart, or none, so both are announced as "table".
  • Write a caption that repeats the column headings, or one such as "Table of data".
  • Keep shadcn's sample caption as a footnote under the table while the real title sits in a heading that is not tied to it.

Exceptions

  • No visible title. Where the design truly has no room for one, an aria-label on the table that says what its rows have in common is the fallback. It meets less of this guideline, since only screen reader users get the title.
  • Tables for layout. A table used only to lay out a page gets no caption; TBL-001 covers when a table is a data table.
  • A product that chooses otherwise. This is a guideline. A table that has a visible title still marks it in code as a heading or caption, which is what 1.3.1 asks. Tying it to the table as its name is our guideline.
  • Neighbouring rules. The table's headers are TBL-001, the heading markup over it is STR-002a, and its scroll area is LAY-001.

Verdict

Insufficient evidence (1 of 3 judges spoke). Only the judges decide; the expert witnesses are shown but do not vote. The judges do not settle this one, so it is a guideline: our own choice, with our reasons above. How verdicts work

Stances on TBL-004
SourceRoleStancePage
WCAG 2.2LawSupports1.3.1 Info and Relationships
WCAG 2.2LawSupports4.1.2 Name, Role, Value
WCAG 2.2LawSupports2.4.6 Headings and Labels
Material DesignJudge No position
Apple Human Interface GuidelinesJudge No position
Carbon Design SystemJudge SupportsData table: usage
Data table: accessibility
GOV.UK Design SystemExpert witness SupportsTable
Nielsen Norman GroupExpert witness No position

Each stance links to the page it rests on, read on the date in the source register. This page never repeats what a source says; read the source itself.

History

  • Version 1.0.0, : First version.

Last checked against the other rules for conflicts on .

More in Tables: 3 rules and 1 guideline · All rules