Identical table summary and caption
Silktide checks tables that have both a summary attribute and a caption, and reports the ones where the two say exactly the same thing. Each serves a different purpose, so duplicating one into the other only creates repetition.
In , the <caption> element is the table's
visible title, while the summary attribute is an invisible description
intended to explain the table's structure to
users.
<!-- Problem: the summary just repeats the caption -->
<table summary="Opening hours">
<caption>Opening hours</caption>
...
</table>
Why this matters
Screen readers announce both the caption and the summary when the listener reaches a table. When they are identical, the same text is read twice, which wastes the listener's time and suggests the summary was filled in to tick a box rather than to help. A useful summary adds something the caption doesn't: how the table is organised, or how best to read it.
How to fix it
- Either remove the
summaryattribute and keep the caption, or - Rewrite the summary so it complements the caption by describing the table's structure:
<!-- Fixed: the summary adds structural information -->
<table summary="Days in the first column, morning and afternoon hours in the second and third">
<caption>Opening hours</caption>
...
</table>
Note that the summary attribute comes from HTML 4 and is obsolete in
current HTML, so removing it is often the better long-term choice. A visible
paragraph before the table can carry the same explanation for everyone.
How Silktide tests this
- Find every table on each page.
- Skip tables marked as presentational with
role="presentation". - Skip tables without a
summaryattribute or without a<caption>. - Compare the two texts, ignoring case and extra whitespace, and report the table if they are identical.