Skip to content

fix(a11y): add persistent instructions for search field#401

Merged
WanjohiSammy merged 1 commit into
masterfrom
a11y/search-field-instructions
Jun 15, 2026
Merged

fix(a11y): add persistent instructions for search field#401
WanjohiSammy merged 1 commit into
masterfrom
a11y/search-field-instructions

Conversation

@WanjohiSammy

@WanjohiSammy WanjohiSammy commented Jun 15, 2026

Copy link
Copy Markdown
Member

Problem

The Search combobox relied on a placeholder that disappears once the user types, leaving no persistent label or instructions describing its purpose, failing WCAG 3.3.2 (Labels or Instructions).

Where the issue is

The "Search Suggestion" edit field in the navbar on the Home page (applies site-wide via the shared navbar include).

Solution

Add programmatically-associated, persistent instructions via aria-describedby pointing to an sr-only element that describes the field and how to operate the suggestions (arrow keys / Enter). The existing aria-label="Search" is preserved.

Where in code

  • _includes/navbar.html - aria-describedby="main-search-instructions" on the input plus a new <span id="main-search-instructions" class="sr-only">...</span>.

Validated against WCAG 2.1 AA (keyboard, screen reader, and 400% zoom where applicable).

The Search combobox relied on a placeholder that disappears once the user
types, leaving no persistent label or instructions describing its purpose.

Adds programmatically-associated, persistent instructions via
aria-describedby pointing to an sr-only element that describes the field's
purpose and how to operate the suggestions (arrow keys / Enter). The
existing aria-label="Search" is preserved. Fixes WCAG 3.3.2 (Labels or
Instructions). Applies site-wide via the shared navbar include.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the accessibility of the site-wide navbar search combobox by adding persistent, programmatically-associated usage instructions for screen reader users (addressing reliance on a disappearing placeholder).

Changes:

  • Added aria-describedby="main-search-instructions" to the main search input.
  • Added an sr-only instructional <span> describing the search purpose and how to navigate suggestions via keyboard.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@WanjohiSammy WanjohiSammy merged commit d4ab1ac into master Jun 15, 2026
2 checks passed
@WanjohiSammy WanjohiSammy deleted the a11y/search-field-instructions branch June 15, 2026 21:58
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.

3 participants