Skip to content

a11y/select-name fails hidden and no-js selects: it does not use the shared hidden-control reader (#989 follow-up) #991

Closed

Description

@nc9

a11y/select-name (packages/rules/src/a11y/select-name.ts) checks every <select> on the page (doc.querySelectorAll("select")) and fails each one with no accessible name. It does not use the shared hidden-control reader (shared/static-hidden.ts) that the other naming checks use (a11y/form-labels, a11y/aria-input-field-name, a11y/button-name and the rest). So it also reports a select that is out of the accessibility tree:

The other checks skip such a select or report it as unconfirmed.

Repro

All runs use v0.0.125 (main ec70d7d) with Bun 1.4.0, against a local fixture. The page loads <link rel="stylesheet" href="/site.css"> and contains <form><select class="no-js" name="sort">…</select></form>.

  • a11y/form-labels: form-labels-unconfirmed (warn), with the reason "may hide it when JavaScript runs".
  • a11y/aria-input-field-name: aria-input-field-name-unconfirmed (warn).
  • a11y/select-name: select-name fail.

A <div class="no-js"> wrapper around the select gives the same split. This is the #989 production case: a product form's select[name="id"].no-js fallback, which the theme hides once scripts run. Fixing #989 leaves one check still failing it.

Acceptance Criteria

  • a11y/select-name reads visibility through shared/static-hidden.ts, like the other naming checks. A select that the hidden attribute, aria-hidden, a decided display: none or a closed dialog hides is skipped, and one a style may hide is select-name-unconfirmed (warn), not a fail.
  • A no-js select, or a select under a non-root no-js wrapper, on a page with an unread stylesheet is unconfirmed with the same "may be hidden when JavaScript runs" label as form-labels.
  • A visible unnamed select still fails, and a select on a page whose styles were all read keeps its verdict.
  • The rule's docs and fix text say how hidden selects are treated.

Activity

  1. added
    bug
    size: S
    rules
    on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrulessize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions