Estimated reading time : 4 min · Published
Define what input means
Decide whether the field accepts free text or requires a catalogue entry. Explain this near the label. Typing a string is not automatically selection: a town identifier needs the chosen record, not merely its displayed name.
Disambiguate repeated names with a useful detail, such as department, without collecting unnecessary information. Define accent, hyphen and alternate-name handling from the catalogue. Do not silently select the first suggestion when several remain plausible.
Allow exploration before acceptance
The W3C combobox pattern describes input associated with suggestions and interactions to explore, accept or leave them. Communicate expansion and the active option. Standard text editing should remain available.
Keep a highlighted suggestion distinct from an accepted value. When the list closes, the person should understand what will be submitted. Test keyboard selection, editing after selection and leaving the field without accepting an option.
For an editable combobox with a list and manual selection, keep DOM focus in the input. aria-activedescendant can reference the explored option; it must identify an element that actually exists in the current list. Update aria-expanded when opening and closing. The visually active option, typed text and accepted business identifier are different states: record each separately during testing.
Specify the manual-selection contract: exploring a suggestion does not commit it; Enter accepts it, while Escape here closes the list without clearing input. This choice does not describe every combobox variant: some automatically accept a suggestion when the field loses focus. After editing an already selected label, invalidate the old identifier until a new match is confirmed if the form requires a catalogue entry.
Scroll the table horizontally to read every column. With a keyboard, focus the table area and use the arrow keys.
| Action in the chosen variant | State to check | Business submission |
|---|---|---|
| Explore with arrow keys | The active option changes; DOM focus stays in the input. | This movement alone confirms no new identifier. |
| Accept with Enter | The label and identifier match the accepted option. | The chosen identifier becomes the value for server validation. |
| Dismiss with Escape | The list closes; this variant preserves typed input. | No additional suggestion is accepted. |
| Edit text after selection | The old identifier is not attached to changed text without validation. | A catalogue choice is still required if the field demands it. |
- W3C APG : Combobox
Guidance consulted on 22 October 2026; scope: editable list with manual selection and no clearing on Escape.
Handle network and catalogue changes
A slow response for older input must not replace suggestions for newer text. Waiting, no match and service failure are different states. Provide another way forward when autocomplete is a convenience rather than an essential dependency.
An entry withdrawn between selection and submission needs server validation and an actionable response. Preserve other fields while the person selects again. Where results are limited, ask for a more specific search rather than presenting a partial list as complete.
Example: towns with the same name
Educational example: two suggestions share a name but belong to different departments. Each shows both details; submission uses the chosen identifier. Testing selects the second entry, edits the text and checks that the old identifier is not accidentally retained. Another test interrupts the network and checks recovery.
Stop an earlier search from replacing suggestions for the current input.
Synthetic case: someone types ‘museum’, then ‘music’, on a slow connection. Delay the first response in a test environment. Cancel the previous operation and also check the active search identifier before displaying results. Cancelling in the browser does not prove that the server stopped processing the request.
- Only the latest input’s suggestions appear; cancellation does not trigger a misleading failure message.
- MDN AbortController
API for cancelling asynchronous operations, including Fetch requests and consumption of their responses.
Reference documents
- W3C combobox pattern · Source consulted
- MDN AbortController · Source consulted
Content updated on
