Skip to content
easeweb
Search topics

Autocomplete fields with silent, mouse-only suggestions

The suggestions under a type-ahead field are a plain list with click handlers or a CSS highlight, so a keyboard can't pick them and a screen reader never says they are there.

WCAG 2.2
SC 2.1.1ASC 4.1.2ASC 4.1.3AA· new in 2.1
Required by
Section 508 · EN 301 549 (EU)
Broken li.classList.toggle('active', i === active)
The accessibility problem illustrated: Highlighted on screen, never read out.
01

The problem

Keyboard users can't pick a suggestion, and screen reader users can't tell that suggestions appeared, which one is highlighted, or that nothing matched.

02

Try it

Type por in Destination, press the down arrow, then Enter.

Can you pick Portland without the mouse? The panel shows what a screen reader says as you type and move. Try pxq too, which matches nothing.

Broken Can you fix this?

Screen reader says:

(Tab to Destination)

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Make the field a combobox whose arrow keys move through suggestions exposed as options, and announce what the list says.

  1. 1Keep focus in the field; the arrow keys move a highlight that assistive technology can see.
  2. 2Say whether the list is open, and announce any count or no-match line.
  3. 3Enter picks and Escape closes; a click or tap picks the same way.
Before

Suggestions that only a click can pick

<label for="dest">Destination</label><input id="dest" type="text" autocomplete="off"><p id="dest-count"></p><ul id="dest-list" class="suggestions" hidden></ul>
After

An ARIA combobox

<label for="dest">Destination</label><input id="dest" type="text" role="combobox" autocomplete="off"  aria-autocomplete="list" aria-expanded="false" aria-controls="dest-list"><p id="dest-count" role="status"></p><ul id="dest-list" role="listbox" aria-label="Destinations" hidden></ul>

Fixing this with an AI coding assistant? Get this guide as Markdown

04

Verify the fix

5 checks, no mouse.

Test with: Keyboard, Screen reader, Zoom, Forced colors

0 of 5 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the shared field or autocomplete component changes.

Limits

This is a starting pattern for a list autocomplete, not for comboboxes that complete text inline, open a grid or a tree, or allow several choices. The snippets leave out fetching and matching. Test the complete journey, with your real data, in the browsers and assistive technology you support.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

Keep this fixed as your code changes.

Turn guides like this into rules your coding agents and CI follow, then have the result retested with a keyboard and screen readers.

How retests work