Skip to content

fix(rules): naming rules read the shared hidden-control reader #993 - #998

Merged
nc9 merged 6 commits into
mainfrom
fix/993-naming-rules-shared-reader
Oct 21, 2026
Merged

nc9 merged 6 commits into
mainfrom
fix/993-naming-rules-shared-reader

Conversation

@nc9

@nc9 nc9 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Closes #993 (partly: see "Left").

Seven naming rules now read visibility through the shared hidden-control reader (shared/static-hidden.ts): aria-meter-name, aria-progressbar-name, aria-toggle-field-name, aria-tooltip-name, aria-treeitem-name, input-image-alt, link-text (empty links; a hidden generic-text link is skipped too).

  • Hidden (hidden, aria-hidden, display: none, closed dialog): skipped, counted in hiddenWithoutName on the pass.
  • A style that may hide it, or a no-js fallback on a page with an unread stylesheet: <check>-unconfirmed (script-state reason for no-js).
  • A visible unnamed element still fails; a fully read page keeps its verdict.
  • Shared reader follow-ups from the fix(rules): a11y/select-name reads hidden selects through the shared reader #991 #994 review: hasNoJsClass bails out before splitting the class (perf test on a 20000-element DOM), and the as T cast in sortUnnamedControls is gone (ControlItem type).
  • Docs and solution text updated per rule, CHANGELOG bullet added.

Left: frame-title, object-alt, empty-heading (read some hidden state themselves; not moved). #988 untouched.

Tests: packages/rules/tests/naming-rules-hidden-993.test.ts (73 tests: per rule hidden, no-js with unread styles, unsettled style, visible-fails, plus the bail-out), existing hidden-control tests still pass. tsgo --noEmit clean, tangly check --strict passes.

Docs changed in this PR. Squirrel agent skill: no change needed.

@claude

claude Bot commented Oct 21, 2026

Copy link
Copy Markdown

Reviewed the diff (rules, shared reader, docs). I did not run the tests, and CI was still pending when I looked. I found nothing that should block the merge.

  • (low) link-text.ts: an unconfirmed empty link whose reason isn't the no-js case loses its contentType label ({ id: item.id }). That is deliberate and commented. Still, a test that pins the row shape for both the style-unconfirmed and no-js paths would stop it drifting.
  • (low) static-hidden.ts hasNoJsClass: the raw.length < 5 bail-out and the /no-js/i pre-test are correct, because the pre-test is case-blind and quirks-mode NO-JS still passes it. The perf test on a 20000-element DOM is the right guard. Check it asserts on work done (a call count) rather than wall-clock time, or it will be flaky on CI.
  • (nit) The solution strings in all seven rules repeat the same long hidden/unconfirmed paragraph. Moving it into a shared constant would keep the wording from drifting across rules. input-image-alt is also missing a period before "An element hidden by…".
  • (nit) The pass/info/fail/unconfirmed branching is copy-pasted across the six aria rules and input-image-alt. A small helper in static-hidden.ts would remove it.
  • (nit) ControlItem allows string | {id, snippet?, label?}, but unconfirmed is typed ControlItem[]. link-text has to narrow it again with typeof item === "string". That is acceptable, since it replaces the old as T cast.

Positives: hidden elements are counted in hiddenWithoutName, a visible unnamed element still fails, and the generic-text hidden skip is consistent. The docs and CHANGELOG are updated, and the new test file is broad (73 tests).

@nc9
nc9 merged commit 5b92c68 into main Oct 21, 2026
15 checks passed
@nc9
nc9 deleted the fix/993-naming-rules-shared-reader branch October 21, 2026 22:43
nc9 added a commit that referenced this pull request Oct 22, 2026
…trols through the shared reader (#1002) (#1004)

Closes #1002. Same shape as #998: hidden elements skipped and counted, may-hide and no-js fallbacks reported unconfirmed, visible violations still fail.

Signed-off-by: Nik Cubrilovic <[email protected]>
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: naming rules without the shared hidden-control reader may fail hidden or no-js elements (#991 follow-up)

1 participant