table-fake-caption
A table's first row should not stand in for a real <caption>
Flags tables with no <caption> whose first row has a single non-empty cell while other rows have multiple cells, for manual review of whether that cell is acting as a fake caption.
Applies to. <table> elements with no <caption> child, at least two rows, and a first row containing exactly one non-empty-text cell while at least one other row has more than one cell. Left out: a table whose role (the first token of its role attribute that names a real role, in any case) is anything but table, grid or treegrid, such as a layout table with role="presentation", which needs no caption; and a table already named by a non-empty aria-label, an aria-labelledby that resolves to text, or a non-empty title, which WCAG accepts as the table's title.
Expectation. A single lone cell in the first row, sitting above rows that clearly have multiple columns, strongly suggests the author is using it as a visual caption/title rather than as a real table cell. Structure conveyed only through this positional convention is not programmatically associated with the table the way a real <caption> element is (1.3.1).
Examples
<table><tr><td>Monthly Sales Report</td></tr><tr><td>Jan</td><td>100</td></tr><tr><td>Feb</td><td>200</td></tr></table>
A lone cell sits alone in the first row above rows that all have multiple cells, and there's no real <caption> — it looks like a caption pretending to be a data cell.
<table><caption>Monthly Sales Report</caption><tr><td>Title cell</td></tr><tr><td>Jan</td><td>100</td></tr></table>
The table has a real <caption> element.
How to check
When this rule can’t decide, it reports cantTell and leaves the question to a person. Each question it can ask is listed here under its reason code, with the steps to answer it. A finding carries the same steps as howToCheck, in the scan’s language. See Output schema.
SINGLE_CELL_FIRST_ROW_NO_CAPTION
- Find the table the report names and look at its first row, which has one text cell.
- Decide whether that cell is a title for the whole table or real data or a header for its column.
- If it is a title, check in the Accessibility pane of the developer tools whether the table has a name (it should come from a caption element).
Pass. The first-row cell is real table data or a header, or the table's title is in a caption that gives the table its name.
Fail. The table's title is shown only as a cell in the first row, not tied to the table as a caption, which fails WCAG 1.3.1.