Skip to content

fix(rules): a11y/select-name reads hidden selects through the shared reader #991 - #994

Merged
nc9 merged 1 commit into
mainfrom
fix/991-select-name
Oct 21, 2026
Merged

nc9 merged 1 commit into
mainfrom
fix/991-select-name

Conversation

@nc9

@nc9 nc9 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

What

a11y/select-name now reads visibility through shared/static-hidden.ts (sortUnnamedControls / unconfirmedRow), like form-labels and aria-input-field-name. A select out of the accessibility tree (hidden, aria-hidden, display: none, closed dialog) is skipped and counted (hiddenWithoutName on the pass). A select a style may hide is select-name-unconfirmed, including a no-js fallback (itself or a non-root ancestor) on a page with an external stylesheet, with the script-state reason from #990. Visible unnamed selects, and selects on pages whose styles were all read, keep their verdict. It gets the show-only (#940), vendor display (#978), operator attribute (#984) and no-js (#989) handling through the shared reader, no one-off logic.

Other rules that bypass the shared reader

Source search of packages/rules/src/a11y: these fail an unnamed element and do not import static-hidden: aria-meter-name, aria-progressbar-name, aria-toggle-field-name, aria-tooltip-name, aria-treeitem-name, input-image-alt, link-text (no hidden handling at all), and frame-title, object-alt, empty-heading (their own partial handling). Not verified one by one that each really fails a hidden element, so filed as #993 (rules, size M, acceptance criteria incl. "fixture first, leave alone if it does not fail"), not fixed here.

Tests

New select-name-hidden-991.test.ts: no-js + external sheet (unconfirmed, script-state label), non-root no-js wrapper, styles read (fail), no marker (fail), hidden/aria-hidden/display:none/closed dialog (pass with hiddenWithoutName), undecidable rule (generic label), named select and no selects, and a parity table asserting select-name, form-labels and aria-input-field-name agree on 8 fixtures. 8 of the 15 tests fail against the old rule. Docs: select-name page gains the hidden-selects section and the unconfirmed row; solution text updated; tangly check --strict passes.

Closes #991

skills: no change

@claude

claude Bot commented Oct 21, 2026

Copy link
Copy Markdown

Reviewed the diff. The change reuses the shared sortUnnamedControls and unconfirmedRow helpers already used by aria-command-name and aria-input-field-name. The new tests cover the hidden, unconfirmed, pass and info paths, plus a parity suite against form-labels and aria-input-field-name. I did not run the tests.

  • (nit) packages/rules/src/a11y/select-name.ts: the solution string is now one very long sentence. Consider splitting the hidden-select details into the docs and keeping the solution short.
  • (nit) select-name.ts: unnamed.hidden > 0 is evaluated twice in the pass branch. A local const would read a little cleaner.
  • (low) Tests: there is no case for a select that is both named and hidden, or for a mix of one failing select and one hidden select. The mix would confirm that only the failing select is reported, with no pass row.

No blocking issues.

@nc9
nc9 merged commit dfbbdaa into main Oct 21, 2026
15 checks passed
@nc9
nc9 deleted the fix/991-select-name branch October 21, 2026 16:33
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/select-name fails hidden and no-js selects: it does not use the shared hidden-control reader (#989 follow-up)

1 participant