Skip to content

fix(docs): add id + name + visually-hidden <label> to docs search input (a11y)#145

Merged
mastermanas805 merged 2 commits into
mainfrom
fix/docs-form-a11y
May 29, 2026
Merged

fix(docs): add id + name + visually-hidden <label> to docs search input (a11y)#145
mastermanas805 merged 2 commits into
mainfrom
fix/docs-form-a11y

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

Summary

UI-6 from the QA backlog (P3). The /docs sidebar search input shipped with only an aria-label, failing the Lighthouse a11y rule "Form elements must have labels". Password managers, form autofill, and screen readers that prefer real <label htmlFor> over aria-label all degraded.

Fix

  • Add id="docs-search" + name="docs-search" to the <input>.
  • Add a visually-hidden <label htmlFor="docs-search">Search documentation</label> so the label is discoverable by AT and Lighthouse without affecting visual layout.
  • Keep the aria-label as a backstop (no harm, and a couple of older AT versions still prefer it).
  • Add a .visually-hidden CSS class — standard clip-rect pattern that removes the element from the layout but leaves it in the a11y tree.

Regression coverage

src/pages/DocsPage.test.tsx:

  • input has id="docs-search" and name="docs-search"
  • a <label> with for="docs-search" exists in the DOM and resolves to the input via htmlFor

Gate

npm run gate green: 1041 passed | 3 skipped.

Live verify (after merge)

curl -s https://instanode.dev/docs | grep -E 'id="docs-search"|for="docs-search"'

🤖 Generated with Claude Code

…ut (a11y)

UI-6 from the QA backlog (P3). The /docs sidebar search input shipped
with only an aria-label, failing the Lighthouse a11y rule "Form elements
must have labels". Password managers, form autofill, and screen readers
that prefer real <label htmlFor> over aria-label all degraded.

Fix:
  - Add id="docs-search" + name="docs-search" to the <input>.
  - Add a visually-hidden <label htmlFor="docs-search"> so the label
    is discoverable by AT and Lighthouse without affecting visual layout.
  - Keep the aria-label as a backstop (no harm, and a couple of older
    AT versions still prefer it).
  - Add a .visually-hidden CSS class — standard clip-rect pattern that
    removes the element from the layout but leaves it in the a11y tree.

Regression coverage in DocsPage.test.tsx:
  - input has id="docs-search" and name="docs-search"
  - a <label> with for="docs-search" exists in the DOM and resolves to
    the input

Verified: npm run gate green (1041 passed | 3 skipped).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 29, 2026

size-limit report 📦

Path Size
dist/assets/index-Ex6CmsJ1.js 0 B (-100% 🔽)
dist/assets/index-BsJUZYRr.css 6.13 KB (0%)
dist/assets/index-BUkatQ42.js 163.42 KB (+100% 🔺)

@mastermanas805 mastermanas805 merged commit 5415010 into main May 29, 2026
16 checks passed
@mastermanas805 mastermanas805 deleted the fix/docs-form-a11y branch May 29, 2026 09:00
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.

1 participant