squirrelscan
GitHub

Tables sharing a name, and tables with none

Several tables on one page need distinct names or a screen reader's table list is unusable. squirrel checks captions and labels.

What a table name is

Screen readers let users list the tables on a page and jump to one. That list shows each table’s accessible name, which comes from a <caption>, from aria-label, or from aria-labelledby.

With one table on the page the name is a convenience. With several it is the only thing distinguishing them, and two tables both called “Results” are the same entry twice.

What squirrel checks

Two check names, at rule severity warning and weight 3. The rule looks at tables that are not role="presentation" or role="none", and does nothing at all unless there is more than one: with none it returns info with No data tables found, and with exactly one it returns info with Only one table found.

A name is taken from aria-label, from aria-labelledby pointing at elements with text, or from a <caption>.

  • table-duplicate-name warns with N duplicate table name(s) found when two or more tables share a name, compared lowercased and trimmed. Items read "revenue by quarter" (2 tables), and the finding suggests Give each table a unique caption or aria-label.
  • tables-without-names warns with N table(s) without accessible names, noting Add caption or aria-label to distinguish tables.
  • table-duplicate-name passes with All tables have unique accessible names when neither problem appears.

How to fix it

<table>
  <caption>Revenue by quarter, 2025</caption>
  ...
</table>

<table>
  <caption>Revenue by quarter, 2026</caption>
  ...
</table>

A <caption> is the better of the two options because it is visible. Everyone gets the label, not only screen reader users, and it cannot drift out of sync with the heading above the table.

Where the design has no room for a caption, aria-label on the <table> does the job. Where a heading above the table already names it, point aria-labelledby at that heading’s id.

Rule IDa11y/table-duplicate-name
CategoryAccessibility
ScopePer-page
Severitywarning
Weight3/10

Enable / disable

Disable this rule

[rules]
disable = ["a11y/table-duplicate-name"]

Disable all Accessibility rules

[rules]
disable = ["a11y/*"]

Enable only this rule

[rules]
enable = ["a11y/table-duplicate-name"]

enable replaces the default ["*"], so this is the only rule selected. Leave disable out: a rule that matches any disable pattern is skipped even when enable names it. Only an enabled setting under a rule’s own [rule_options] table overrides both lists.

Accessibility findings ship in every audit next to the SEO, performance and agent experience rules. See Website security scan with AI for how an agent works through a report.

References

Check your site

Run squirrel audit https://example.com and open the Accessibility section of the report. Duplicate names and missing names are reported as separate checks. Signed-out local audits need no account and cost nothing. Signed-in audits spend credits.

Type to search…

↑↓ navigate↵ openesc close