Skip to content

Make the site search box's accessible name match its visible text #266

Closed

Description

@accesswatch

What is wrong

The search box at the top of every page of the published site is announced as "Search documentation", but the text a sighted user sees in it is "Search docs...". In scripts/build-html.js the input has both a visually hidden <label> ("Search docs") and an aria-label="Search documentation"; the aria-label replaces the label, so the accessible name does not contain the visible words. A voice control user who says "click Search docs" may not reach the field (WCAG 2.5.3 Label in Name), and the label element is dead code.

Found by a code review of the site template on 2026-10-28; not yet confirmed with assistive technology.

Why this is a good first issue

It is a one-attribute change in one file, and it teaches how a field gets its accessible name.

What to do

  1. In scripts/build-html.js, remove aria-label="Search documentation" from the site-search input, so its name comes from <label for="site-search">Search docs</label>.
  2. Check the search page template in the same file for the same pattern.
  3. Run npm run build:html and commit the script with the regenerated html/ files.

Acceptance criteria

  • The search input has no aria-label, and its <label> text matches the start of its visible placeholder.
  • With a screen reader, Tab to the search box: it is announced as "Search docs" and as an edit or search field. Say in the pull request which screen reader and browser you used.

Generated by Claude Code

Activity

  1. accesswatch commented on Oct 28, 2026

    @accesswatch
    CollaboratorAuthor

    The markup fix is merged in #271: aria-label="Search documentation" is removed from the site-search input in both templates (every page and the search page), so the field takes its name from <label for="site-search">Search docs</label>.

    What remains is the screen reader check from the acceptance criteria, which could not be done where the change was made. Tab to the search box and confirm it is announced as "Search docs" and as an edit or search field. Then close this issue and say which screen reader and browser you used.


    Generated by Claude Code

  2. accesswatch commented on Oct 28, 2026

    @accesswatch
    CollaboratorAuthor

    Checked on the live site in a browser (Chromium, in the Claude desktop app) after pull request 271 deployed. The search box (#site-search, type search) no longer has an aria-label. Its name comes from its label element, "Search docs", which is visually hidden but present in the accessibility tree. The visible text is the placeholder "Search docs…", so the accessible name contains the visible text, as WCAG 2.5.3 Label in Name asks. The submit button is named "Submit search". This is a check of the accessibility tree, not a listen with a screen reader. Closing as fixed.


    Generated by Claude Code

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

    accessibilityAccessibility barriers, reports and improvementsgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions