NOTE: Work on drafting this section is in progress and tracked by issue 31.
+
+ A combobox is a widget made up of the combination of two distinct elements:
+ 1) a single-line textbox, and 2) an associated pop-up element for helping users set the value of the textbox.
+ The popup may be a listbox,
+ grid,
+ tree, or
+ dialog.
+ Many implementations also include a third optional element -- a graphical button adjacent to the textbox, indicating the availability of the popup.
+ Activating the button displays the popup if suggestions are available.
+
+
+ The popup is hidden by default, and the conditions that trigger its display are specific to each implementation.
+ For example, some implementations do not display suggested values for the textbox in the popup until several characters are typed in the text box.
+ While in other implementations, the popup is displayed when the textbox receives focus.
+
+
Combobox widgets are useful for setting the value of a single-line textbox in one of two types of scenarios:
+
+
+ The value for the textbox must be chosen from a predefined set of allowed values,
+ e.g., a location field must contain a valid location name.
+ Note that the listbox and menu button patterns are also useful in this scenario; differences between combobox and alternative patterns are described below.
+
+
+ The textbox may contain any arbitrary value, but it is advantageous to suggest possible values to the user,
+ e.g., a search field may suggest similar or previous searches to save the user time.
+
+
+
+ The nature of the suggested values and the way the suggestions are presented is called the autocomplete behavior.
+ Comboboxes can have one of four forms of autocomplete:
+
+
+
+ No autocomplete: When the popup is triggered, the suggested values it contains are the same regardless of the characters typed in the textbox.
+ For example, the popup suggests a set of recently entered values, and the suggestions do not change as the user types.
+
+
+ List autocomplete with manual selection: When the popup is triggered, it presents suggested values that complete or logically correspond to the characters typed in the textbox.
+ The character string the user has typed will become the value of the textbox unless the user selects a value in the popup.
+
+
+ List autocomplete with automatic selection: When the popup is triggered, it presents suggested values that complete or logically correspond to the characters typed in the textbox,
+ and the first suggestion is automatically highlighted as selected.
+ The automatically selected suggestion becomes the value of the textbox when the combobox loses focus unless the user chooses a different suggestion or changes the character string in the textbox.
+
+
+ List with inline autocomplete: This is the same as list with automatic selection with one additional feature.
+ The portion of the selected suggestion that has not been typed by the user, a completion string, appears inline after the input cursor in the textbox.
+ The inline completion string is visually highlighted and has a selected state.
+
+
+
+ With any form of list autocomplete, the popup may appear and disappear as the user types.
+ For example, if the user types a two character string that triggers five suggestions to be displayed but then types a third character that forms a string that does not have any matching suggestions,
+ the popup may close and, if present, the inline completion string disappears.
+
+
+ When constructing a compact widget that asks users to choose one value from a known set of discrete values, often either a listbox or menu button is simpler to implement and use.
+ One feature of combobox that distinguishes it from both listbox and menu button is that the value of the combobox is presented in an edit field.
+ Thus, the combobox gives users one function that both listbox and menu button lack, namely the ability to select some or all of the value for copying to the clipboard.
+ A feature that distinguishes both combobox and menu button from listbox is that they can enable users can navigate the set of allowed values and, at any point, decide to keep the current value by pressing escape.
+ In contrast, navigating a listbox immediately changes its value, and escape does not provide an undo mechanism.
+
+
+ The options for a combobox to popup a grid, tree, or dialog were introduced in ARIA 1.1.
+ Changes made in the ARIA 1.1 specification also add support for a code pattern that enables assistive technologies to present the textbox and popup as separately perceivable elements.
+ While the ARIA 1.1 pattern is recommended, both patterns are described in the following sections,
+ and there are no plans to deprecate the ARIA 1.0 pattern.
+
Note: The popup indicator icon (if present), the popup, and the popup descendants are excluded from the page Tab sequence.
+
+
Textbox Keyboard Interaction
+
When focus is in the textbox:
+
+
Down Arrow: If the popup is available, moves focus into the popup:
+
+
If the autocomplete behavior automatically selects a suggestion, focus is placed on the suggestion following the automatically selected suggestion.
+
Otherwise, places focus on the first focusable element in the popup.
+
+
+
Alt + Down Arrow (Optional): Performs the same function as Down Arrow.
+
Up Arrow (Optional): If the popup is available, places focus on the last focusable element in the popup.
+
Printable Characters: Type characters in the textbox. Note that some implementations may regard certain characters as invalid and prevent their input.
+
+ Enter: If an autocomplete suggestion is automatically selected, accepts the suggestion either by placing the input cursor at the end of the accepted value in the textbox or by performing a default action on the value.
+ For example, in a messaging application, the default action may be to add the accepted value to a list of message recipients and then clear the textbox so the user can add another recipient.
+
+
Escape: Dismisses the popup if it is visible. Optionally, clears the textbox.
+
Alt + Up Arrow (Optional): Dismisses the popup if visible.
+
Right Arrow: Moves the cursor right one character. Does nothing if the cursor is on the right-most character.
+
Left Arrow: Moves the cursor left one character. Does nothing if the cursor is on the left-most character.
+
Control + Right Arrow: Moves the cursor right one word. Does nothing if the cursor is on the right-most word .
+
Control + Left Arrow: Moves the cursor left one word. Does nothing if the cursor is on the left-most word.
+
Home: Moves the cursor to the first character. Does nothing if the cursor is on the first character.
+
End: Moves the cursor to the last character. Does nothing if the cursor is on the last character.
+
Delete: Deletes the current character or, if text is selected, deletes the selected text
+
Backspace: Deletes the previous character, or, if text is selected, deletes the selected text.
+
Shift + Right Arrow: Extends selection one character to the right. Does nothing if the cursor is on the right-most character.
+
Shift + Left Arrow: Extends selection one character to the left. Does nothing if the cursor is on the left-most character.
+
Control + Shift + Right Arrow: Extends selection one word to the right. Does nothing if the cursor is after the right-most word.
+
Control + Shift + Left Arrow: Extends selection one word to the left. Does nothing if the cursor is at the start of the left-most word.
+
Shift + Home: Extends selection from the cursor position to the first character.
+
Shift + End: Extends selection from the cursor position to the last character.
+
Control + A (Optional): Selects all the text in the textbox.
+
+
Listbox Popup Keyboard Interaction
+
When focus is in a listbox popup:
+
+
Enter: Accepts the focused option in the listbox by closing the popup and placing the accepted value in the textbox with the input cursor at the end of the value.
+
Escape: Closes the popup and returns focus to the textbox. Optionally, clears the contents of the textbox.
+
+ Right Arrow: Returns focus to the textbox without closing the popup and moves the input cursor one character to the right.
+ If the input cursor is on the right-most character, the cursor does not move.
+
+
+ Left Arrow: Returns focus to the textbox without closing the popup and moves the input cursor one character to the left.
+ If the input cursor is on the left-most character, the cursor does not move.
+
+
Any printable character: Returns the focus to the textbox without closing the popup and types the character.
+
Backspace (Optional): Returns focus to the textbox and deletes the character prior to the cursor.
+
Delete (Optional): Returns focus to the textbox, removes the selected state if a suggestion was selected, and removes the inline autocomplete string if present.
+
Down Arrow: Moves focus to and selects the next option. If focus is on the last option, either returns focus to the textbox or does nothing.
+
Up Arrow: Moves focus to and selects the previous option. If focus is on the first option, either returns focus to the textbox or does nothing.
+
Home (Optional): Either moves focus to and selects the first option or returns focus to the textbox and places the cursor on the first character.
+
End (Optional): Either moves focus to the last option or returns focus to the textbox and places the cursor after the last character.
Selection follows focus in the listbox; the listbox allows only one suggested value to be selected at a time for the textbox value.
+
+
Grid Popup Keyboard Interaction
+
+ In a grid popup, each suggested value may be represented by either a single cell or an entire row.
+ See notes below for how this aspect of grid design effects the keyboard interaction design and the way that selection moves in response to focus movements.
+
+
+
Enter: Accepts the currently selected suggested value by closing the popup and placing the selected value in the textbox with the input cursor at the end of the value.
+
Escape: Closes the popup and returns focus to the textbox. Optionally, clears the contents of the textbox.
+
Any printable character: Returns the focus to the textbox without closing the popup and types the character.
+
Backspace (Optional): Returns focus to the textbox and deletes the character prior to the cursor.
+
Delete (Optional): Returns focus to the textbox, removes the selected state if a suggestion was selected, and removes the inline autocomplete string if present.
+
+ Right Arrow: Moves focus one cell to the right.
+ Optionally, if focus is on the right-most cell in the row, focus may move to the first cell in the following row.
+ If focus is on the last cell in the grid, either does nothing or returns focus to the textbox.
+
+
+ Left Arrow: Moves focus one cell to the left.
+ Optionally, if focus is on the left-most cell in the row, focus may move to the last cell in the previous row.
+ If focus is on the first cell in the grid, either does nothing or returns focus to the textbox.
+
+
+ Down Arrow: Moves focus one cell down.
+ If focus is in the last row of the grid, either does nothing or returns focus to the textbox.
+
+
+ Up Arrow: Moves focus one cell up.
+ If focus is in the first row of the grid, either does nothing or returns focus to the textbox.
+
+
+ Page Down (Optional): Moves focus down an author-determined number of rows, typically scrolling so the bottom row in the currently visible set of rows becomes one of the first visible rows.
+ If focus is in the last row of the grid, focus does not move.
+
+
+ Page Up (Optional): Moves focus up an author-determined number of rows, typically scrolling so the top row in the currently visible set of rows becomes one of the last visible rows.
+ If focus is in the first row of the grid, focus does not move.
+
+
Home (Optional): Either:
+
+
Moves focus to the first cell in the row that contains focus. Or, if the grid has fewer than three cells per row or multiple suggested values per row, focus may move to the first cell in the grid.
+
Returns focus to the textbox and places the cursor on the first character.
+
+
+
End (Optional): Either:
+
+
Moves focus to the last cell in the row that contains focus. Or, if the grid has fewer than three cells per row or multiple suggested values per row, focus may move to the last cell in the grid.
+
Returns focus to the textbox and places the cursor after the last character.
+
+
+
Control + Home (optional): moves focus to the first row.
+
Control + End (Optional): moves focus to the last row.
The grid allows only one suggested value to be selected at a time for the textbox value.
+
In a grid popup, each suggested value may be represented by either a single cell or an entire row. This aspect of design effects focus and selection movement:
+
+
If every cell contains a different suggested value:
+
+
Selection follows focus so that the cell containing focus is selected.
+
Horizontal arrow key navigation typically wraps from one row to another.
+
Vertical arrow key navigation typically wraps from one column to another.
+
+
+
If all cells in a row contain information about the same suggested value:
+
+
Either the row containing focus is selected or a cell containing a suggested value is selected when any cell in the same row contains focus.
+
Horizontal key navigation may wrap from one row to another.
+
Vertical arrow key navigation does not wrap from one column to another.
+
+
+
+
+
+
Tree Popup Keyboard Interaction
+
+ In some implementations of tree popups, some or all parent nodes may serve as suggestion category labels so may not be selectable values.
+ See notes below for how this aspect of the design effects the way selection moves in response to focus movements.
+
+
When focus is in a vertically oriented tree popup:
+
+
Enter: Accepts the currently selected suggested value by closing the popup and placing the selected value in the textbox with the input cursor at the end of the value.
+
Escape: Closes the popup and returns focus to the textbox. Optionally, clears the contents of the textbox.
+
Any printable character: Returns the focus to the textbox without closing the popup and types the character.
+
Right arrow:
+
+
When focus is on a closed node, opens the node; focus and selection do not move.
+
When focus is on a open node, moves focus to the first child node and selects it if it is selectable.
+
When focus is on an end node, does nothing.
+
+
+
Left arrow:
+
+
When focus is on an open node, closes the node.
+
When focus is on a child node that is also either an end node or a closed node, moves focus to its parent node and selects it if it is selectable.
+
When focus is on a root node that is also either an end node or a closed node, does nothing.
+
+
+
Down Arrow: Moves focus to the next node that is focusable without opening or closing a node and selects it if it is selectable.
+
Up Arrow: Moves focus to the previous node that is focusable without opening or closing a node and selects it if it is selectable.
+
Home: Moves focus to the first node in the tree without opening or closing a node and selects it if it is selectable.
+
End: Moves focus to the last node in the tree that is focusable without opening a node and selects it if it is selectable.
The tree allows only one suggested value to be selected at a time for the textbox value.
+
+ In a tree popup, some or all parent nodes may not be selectable values; they may serve as category labels for suggested values.
+ If focus moves to a node that is not a selectable value, either:
+
+
The previously selected node, if any, remains selected until focus moves to a node that is selectable.
+
There is no selected value.
+
In either case, focus is fisually distinct from selection so users can readily see if a value is selected or not.
+
+
+
If the nodes in a tree are arranged horizontally:
+
+
Down Arrow performs as Right Arrow is described above, and vice versa.
+
Up Arrow performs as Left Arrow is described above, and vice versa.
+
+
+
+
Dialog Popup Keyboard Interaction
+
When focus is in a dialog popup:
+
+
There are two ways to close the popup and return focus to the textbox:
+
+
Perform an action in the dialog, such as activate a button, that specifies a value for the textbox.
+
+ Cancel out of the dialog, e.g., press Escape or activate the cancel button in the dialog.
+ Canceling either returns focus to the text box without changing the textbox value or returns focus to the textbox and clears the textbox.
+
+ Unlike other combobox popups, dialogs do not support aria-activedescendant so DOM focus moves into the dialog from the textbox.
+
+
+
+
+
WAI-ARIA Roles, States, and Properties
+
+ The role, state, and property guidance where the ARIA 1.1 and ARIA 1.0 patterns differ is listed first.
+ The subsequent guidance applies to both patterns.
+
+
+
In a combobox implementing the ARIA 1.1 pattern:
+
+
The element that serves as the combobox container has role combobox.
+
The element with role combobox contains or owns a textbox element that has either role textbox or role searchbox.
+
When the combobox popup is visible, the combobox element contains or owns an element that has role listbox, tree, grid, or dialog.
+
+ If the combobox popup has a role other than listbox, the element with role combobox has aria-haspopup set to a value that corresponds to the popup type.
+ That is, aria-haspopup is set to grid, tree, or dialog.
+ Note that elements with role combobox have an implicit aria-haspopup value of listbox.
+
+
When the combobox popup is visible, the textbox element has aria-controls set to a value that refers to the combobox popup element.
+
+
+
In a combobox implementing the ARIA 1.0 pattern:
+
+
The element that serves as the textbox has role combobox.
+
When the combobox popup is visible, the element with role combobox has aria-owns set to a value that refers to an element with role listbox.
+
+ the element with role combobox has a value for aria-haspopup of listbox.
+ Note that elements with role combobox have an implicit aria-haspopup value of listbox.
+
+
+
+
+ The textbox element has a value for aria-multiline of false.
+ Note that the default value of aria-multiline is false.
+
+
+ When the combobox popup is not visible, the element with role combobox has aria-expanded set to false.
+ When the popup element is visible, aria-expanded is set to true.
+ Note that Elements with role combobox have a default value for aria-expanded of false.
+
+
When a combobox receives focus, DOM focus is placed on the textbox element.
+
When a descendant of a listbox, grid, or tree popup is focused, DOM focus remains on the textbox and the textbox has aria-activedescendant set to a value that refers to the focused element within the popup.
+
In a combobox with a listbox, grid, or tree popup, when a suggested value is visually indicated as the currently selected value, the option, gridcell, row, or treeitem containing that value has aria-selected set to true.
+
+ If the combobox has a visible label, the element with role combobox has aria-labelledby set to a value that refers to the labeling element.
+ Otherwise, the combobox element has a label provided by aria-label.
+
+
The textbox element has aria-autocomplete set to a value that corresponds to its autocomplete behavior:
+
+
none: When the popup is displayed, the suggested values it contains are the same regardless of the characters typed in the textbox.
+
list: When the popup is triggered, it presents suggested values that complete or logically correspond to the characters typed in the textbox.
+
+ both: When the popup is triggered, it presents suggested values that complete or logically correspond to the characters typed in the textbox.
+ In addition, the portion of the selected suggestion that has not been typed by the user, a completion string, appears inline after the input cursor in the textbox.
+ The inline completion string is visually highlighted and has a selected state.
+
+
+
+
+
+ The roles, states, and properties for popup elements are defined in their respective design patterns.
+ When refering to the following design patterns, note that a combobox is a single-select widget where selection follows focus in the popup.
+
A listbox widget presents a list of options and allows a user to select one or more of them.
A listbox that allows a single option to be chosen is a single-select listbox; one that allows multiple options to be selected is a multi-select listbox.
@@ -1312,7 +1665,7 @@
Keyboard Interaction
-
+
WAI-ARIA Roles, States, and Properties
An element that contains or owns all the listbox options has role listbox.
@@ -2226,7 +2579,7 @@
Keyboard Interaction
-
+
WAI-ARIA Roles, States, and Properties
All tree nodes are contained in or owned by an element with role tree.
-
- Replace this paragraph with an overview of the example that is something like the following. The
- below example section demonstrates a simple checkbox that implements the
- design pattern for checkbox.
- This example uses ... summarize salient techniques )
+ The following example demonstrates an implementation of the
+ combobox design pattern
+ that uses the option to popup a grid containing suggested values.
Similar examples include:
@@ -38,25 +38,31 @@
Example of ARIA 1.1 Combobox with Grid Popup
Example
-
-
-
This is the place where the reader will experience the functioning example.
-
-
The HTML in this section along with the javascript and CSS it uses demonstrate
- the design pattern.