Skip to content

fix(rules): exclude hidden tables from table-duplicate-name - #1641

Merged
nc9 merged 3 commits into
squirrelscan:mainfrom
WilliamK112:codex/table-duplicate-name-hidden-1637
Nov 9, 2026
Merged

nc9 merged 3 commits into
squirrelscan:mainfrom
WilliamK112:codex/table-duplicate-name-hidden-1637

Conversation

@WilliamK112

@WilliamK112 WilliamK112 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • a11y/table-duplicate-name now compares only tables in the accessibility tree. A table inside a closed <dialog>, or under a hidden (not hidden="until-found"), inert, aria-hidden="true" or display:none ancestor, is resolved with the shared createStaticVisibility reader (plus an inert ancestor walk) and left out of the comparison
  • excluded tables are counted as hiddenTables in the check's details rather than silently dropped
  • a table a style may hide but squirrel cannot settle (external stylesheet, pseudo-class, media query) is reported on table-duplicate-name-unconfirmed via the shared unconfirmedRow, not as a duplicate
  • the "only one table" / "no tables" info and tables-without-names now count exposed and unsettled tables only
  • documented the behaviour on the rule page and in the unreleased changelog

Closes #1637

Acceptance criteria

  • Tables inside a closed <dialog> are not counted as exposed
  • Tables under a hidden, inert or inline display:none ancestor are excluded the same way
  • /tables-hidden (one exposed "Content" table, two "Size" tables in separate closed dialogs) passes
  • /tables-visible (two exposed "Size" tables) still warns
  • Excluded tables surface as hiddenTables, and unsettled ones as an explicit unconfirmed row
  • Unit tests cover the closed dialog, hidden and visible cases

Verification

  • bun test ./packages/rules/tests/table-duplicate-name-hidden-1637.test.ts — 11 pass, 0 fail
  • bun run scripts/test-suites.ts --run rules — 9,946 pass, 25 todo, 1 fail: the timing assertion in integrity-adversarial-784.test.ts (untouched here) failed under full-suite load and passes 36/36 when that file is run alone, twice
  • bun run --cwd packages/rules typecheck
  • bun run lint, bun run format:check
  • bun run docs:check — all checks passed

Checklist

  • I added or updated tests for behavioral changes.
  • I did not include secrets, customer data, or incompatible third-party material.
  • Every commit includes a DCO Signed-off-by line (git commit -s).

Docs: docs/rules/a11y/table-duplicate-name.mdx. Skill: none.

Closes squirrelscan#1637

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Ching-Wei Kang <[email protected]>

nc9 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Reviewed head: 098c1aa

Verdict: no blocking findings, pending maintainer review. Thanks for the fix and the thorough tests.

Findings, most severe first:

  1. Low: packages/rules/src/a11y/table-duplicate-name.ts leans on the shared createStaticVisibility and unconfirmedRow helpers. I only read the diff, not those helpers, so please confirm the hidden="until-found" and closed <dialog> handling against shared/static-hidden (the new tests exercise both and pass in CI).
  2. Low: the new table-duplicate-name-unconfirmed check name is user-visible. The rule docs and changelog describe it, so no change needed, but the maintainer may want to confirm the name matches other -unconfirmed rows.
  3. Nit: the isInert ancestor walk is O(depth) per table. Fine for realistic pages, no action needed.

Checks against the issue's acceptance criteria (#1637): closed dialog, hidden, inert and inline display:none are excluded and counted as hiddenTables. The /tables-visible control still warns. Tests cover each case.

Conventions: rule docs updated, CHANGELOG [Unreleased] entry added, no new dependency, DCO check green. All 16 CI checks are green or skipped on this head.

nik

@WilliamK112

Copy link
Copy Markdown
Contributor Author

Thanks for the review. On the two low findings:

  1. Confirmed against packages/rules/src/shared/static-hidden.ts: uaHidden treats the hidden attribute as hiding unless its value is exactly the until-found keyword (line 258), and a <dialog> hides unless it has open (line 259). This rule creates the resolver without closedDialogsShown, so a closed dialog's tables count as hidden. The hidden="until-found" and <dialog open> tests pin both.
  2. The row is built by the shared unconfirmedRow("table-duplicate-name", …), which appends UNCONFIRMED_CHECK_SUFFIX. That gives table-duplicate-name-unconfirmed, the same <check>-unconfirmed pattern as aria-meter-name, frame-title, empty-heading and the other rows built by unconfirmedRow.

No code change needed from my side unless the maintainer prefers a different name.

nc9 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Reviewed head: ae31851

Verdict: no blocking findings, pending maintainer review.

The only commit since the last reviewed head (098c1aa) is style(rules): format the #1637 test file with oxfmt. It touches only packages/rules/tests/table-duplicate-name-hidden-1637.test.ts. I skimmed the diff for logic changes and found none, but a formatting commit like this rewrites every line, so it is worth one more glance at the test file if you want certainty. No source or docs changes, so the earlier review of the rule still stands, including the author's confirmation of the hidden="until-found" and closed <dialog> handling.

Conventions unchanged: rule docs, CHANGELOG entry, no new dependency, DCO sign-off. CI: all 15 completed checks on this head are green, 1 skipped.

nik

@nc9
nc9 merged commit 7ca2218 into squirrelscan:main Nov 9, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

a11y/table-duplicate-name: closed-dialog tables counted as simultaneously exposed

2 participants