Legacy ARIA 1.0 Combobox without Autocomplete Example
NOTE: Please provide feedback on this example page in issue 555.
The below combobox that enables users to choose a term from a hypothetical list of previously searched terms demonstrates the
ARIA 1.0 design pattern for combobox.
The design pattern describes four types of autocomplete behavior.
This example illustrates the autocomplete behavior known as no autocomplete
.
The terms that appear in the listbox popup are not related to the string that is present in the textbox.
In this implementation, The listbox popup is not automatically triggered; it is displayed only when the user opens it.
Similar examples include:
- ARIA 1.0 Combobox with List Autocomplete: A combobox that demonstrates the autocomplete behavior known as
list with manual selection
and uses the ARIA 1.0 implementation pattern. - ARIA 1.0 Combobox with Both List and Inline Autocomplete: A combobox that demonstrates the autocomplete behavior known as
list with inline autocomplete
and uses the ARIA 1.0 implementation pattern. - ARIA 1.1 Combobox with Listbox Popup: Comboboxes that demonstrate the various forms of autocomplete behavior using a listbox popup and use the ARIA 1.1 implementation pattern.
- ARIA 1.1 Combobox with Grid Popup: A combobox that presents suggestions in a grid, enabling users to navigate descriptive information about each suggestion.
Example
- weather
- salsa recipes
- cheap flights to NY
- dictionary
- baseball scores
- hotels in NY
- mortgage calculator
- restaurants near me
- free games
- gas prices
- classical music
Keyboard Support
The example combobox on this page implements the following keyboard interface. Other variations and options for the keyboard interface are described in the Keyboard Interaction section of the combobox design pattern.
Textbox
Key | Function |
---|---|
Down Arrow |
|
Up Arrow |
|
Enter |
|
Standard single line text editing keys |
|
Listbox Popup
NOTE: When visual focus is in the listbox, DOM focus remains on the textbox and the value of aria-activedescendant
on the textbox is set to a value that refers to the listbox option that is visually indicated as focused.
Where the following descriptions of keyboard commands mention focus, they are referring to the visual focus indicator.
For more information about this focus management technique, see
Using aria-activedescendant to Manage Focus.
Key | Function |
---|---|
Enter |
|
Escape |
|
Down Arrow |
|
Up Arrow |
|
Right Arrow | Moves visual focus to the textbox and moves the editing cursor one character to the right. |
Left Arrow | Moves visual focus to the textbox and moves the editing cursor one character to the left. |
Home | Moves visual focus to the textbox and places the editing cursor at the beginning of the field. |
End | Moves visual focus to the textbox and places the editing cursor at the end of the field. |
Printable Characters |
|
Role, Property, State, and Tabindex Attributes
The example combobox on this page implements the following ARIA roles, states, and properties. Information about other ways of applying ARIA roles, states, and properties is available in the Roles, States, and Properties section of the combobox design pattern.
Textbox
Role | Attribute | Element | Usage |
---|---|---|---|
combobox
|
input[type="text"] |
|
|
aria-autocomplete="none"
|
input[type="text"] |
Indicates that the suggestions in the combobox popup are not values that complete the current textbox input. | |
aria-haspopup="true"
|
input[type="text"] |
Indicates that the combobox can popup another element to suggest values. | |
aria-owns="#IDREF"
|
input[type="text"] |
|
|
aria-expanded="false"
|
input[type="text"] |
Indicates that the popup element is not displayed. | |
aria-expanded="true"
|
input[type="text"] |
Indicates that the popup element is displayed. | |
aria-activedescendant="IDREF"
|
input[type="text"] |
|
Listbox Popup
Role | Attribute | Element | Usage |
---|---|---|---|
listbox
|
ul
|
Identifies the ul element as a listbox . |
|
aria-label="Previous Searches"
|
ul |
Provides a label for the listbox . |
|
option
|
li |
|
|
aria-selected="true"
|
li |
|
Javascript and CSS Source Code
- CSS: combobox-1.0.css
- CSS: listbox.css
- Javascript: combobox-1.0-list.js
- Javascript: listbox.js
- Javascript: listboxOption.js
HTML Source Code