Autocomplete and Search Patterns
You'll learn how to build autocomplete interfaces that assistive technologies can properly announce and navigate.
What Autocomplete Means for Accessibility
An autocomplete or search widget displays a list of suggestions as the user types. For sighted users, this is visually obvious—but screen reader users need explicit ARIA attributes to understand what's happening, how many results were found, and which suggestion they're focused on.
Core ARIA Attributes for Autocomplete
Use aria-autocomplete on the input to describe the behavior:
aria-autocomplete="list"– suggestions appear in a popup listaria-autocomplete="inline"– suggestion completes the input inlinearia-autocomplete="both"– combination of list and inline
The input also needs:
aria-controlspointing to the result container'sidaria-expanded="true"when results are visiblerole="combobox"to establish the pattern
The results container should have role="listbox" and each result role="option".
Announcing Result Counts
Use a live region with aria-live="polite" and aria-atomic="true" to announce the count when results update:
<div aria-live="polite" aria-atomic="true" class="sr-only">
5 results available
</div>
Managing Focus
When users arrow down into results, move aria-activedescendant on the input to reference the highlighted option's id. This tells screen readers which suggestion is active without actually moving DOM focus from the input.
Think of it like a waiter announcing each dish on a menu as you point, without making you hold each plate.
Key Takeaway:
Accessible autocomplete requires aria-autocomplete, aria-expanded, a listbox for results, live region announcements for result counts, and aria-activedescendant to manage virtual focus as users navigate suggestions.