Skip to content

fix(a11y): keep keyboard-focused search suggestion visible (WCAG 2.4.11)#412

Open
WanjohiSammy wants to merge 2 commits into
masterfrom
swanjohi/search-typeahead-focus-scroll
Open

fix(a11y): keep keyboard-focused search suggestion visible (WCAG 2.4.11)#412
WanjohiSammy wants to merge 2 commits into
masterfrom
swanjohi/search-typeahead-focus-scroll

Conversation

@WanjohiSammy

@WanjohiSammy WanjohiSammy commented Jul 7, 2026

Copy link
Copy Markdown
Member

Problem

WCAG 2.4.11 Focus Not Obscured (Minimum). When a user types in the top-navbar search box and arrows through the autocomplete suggestions, the keyboard-focused suggestion could be scrolled off-screen (obscured), because the page does not reliably keep it in view. This is most visible on short or zoomed-in viewports where the suggestion list is taller than the visible area.

This completes the earlier partial fix in #406 (scroll active search suggestion into view), which did not fully resolve the issue across browsers and arrow directions.

Root cause

The navbar search input is driven by two keyboard navigators at once:

  1. Legacy Swiftype (jquery.swiftype.autocomplete.js) - owned the visible highlight (active class) and Enter selection.
  2. ARIA ComboboxAutocomplete (combobox-autocomplete.js) - owns aria-selected / aria-activedescendant and scroll-into-view.

Fix

Make the suggestion list scroll internally (the standard ARIA combobox pattern) and make the combobox the single keyboard navigator.

Before

image

After

image

WanjohiSammy and others added 2 commits July 7, 2026 12:58
The navbar search box was driven by two keyboard navigators at once (legacy
Swiftype and the ARIA ComboboxAutocomplete), and the suggestion list had no
height cap so the whole page scrolled to reveal lower options. Together these
let the keyboard-focused suggestion be obscured.

Cap the suggestion list to the viewport and scroll it internally (the standard
ARIA combobox pattern) so the page never scrolls and the input stays in view,
and make the combobox the single navigator that keeps the visible highlight in
sync with aria-selected. Enter still selects the highlighted suggestion.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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