Tables have different content in the summary attribute and <caption>

Table captions and summaries have different content.

On this page

Impact

ScanGov impact ratings

About

The summary attribute should describe the table structure, while <caption> should have the onscreen title. Accurate table mark-up helps users of screen readers.

Risks

Screen readers announce structured content incorrectly.

Why it's important

Helps screen readers announce structured content (tables, lists) in a logical order that users can understand.

User stories

As a screen reader user, I want tables and lists to be properly structured so that I can understand the relationships between items.

Code

Failing pattern:

<!-- Fail: caption and summary contain the same text -->
<table summary="Agency contacts">
  <caption>Agency contacts</caption>
</table>

Passing pattern:

<!-- Pass: summary adds detail beyond the caption -->
<table summary="Columns: Name, Phone, Email, Office hours">
  <caption>Agency contacts</caption>
</table>

Error

ScanGov messaging when a site fails a standard:

Failed: Tables have different content in the summary attribute and <caption>

Guidance

Indicators

On this page