Skip to content

Commit 60e1778

Browse files
authored
docs(select): keyboard navigation (#3156)
1 parent 85c3921 commit 60e1778

File tree

1 file changed

+61
-2
lines changed

1 file changed

+61
-2
lines changed

docs/api/select.md

+61-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import EncapsulationPill from '@components/page/api/EncapsulationPill';
1818
<EncapsulationPill type="shadow" />
1919

2020

21-
Selects are form controls to select an option, or options, from a set of options, similar to a native `<select>` element. When a user taps the select, a dialog appears with all of the options in a large, easy to select list.
21+
Selects are form controls to select an option, or options, from a set of options. When a user taps the select, a dialog appears with all of the options in a large, easy to select list.
2222

2323
A select should be used with child `<ion-select-option>` elements. If the child option is not given a `value` attribute then its text will be used as the value.
2424

@@ -62,6 +62,8 @@ import NoVisibleLabel from '@site/static/usage/v7/select/no-visible-label/index.
6262

6363
By default, the select allows the user to select only one option. The alert interface presents users with a radio button styled list of options. The select component's value receives the value of the selected option's value.
6464

65+
Keyboard interactions for single selection are described in the [Keyboard Interactions](#single-selection-1) section below.
66+
6567
import SingleSelectionExample from '@site/static/usage/v7/select/basic/single-selection/index.md';
6668

6769
<SingleSelectionExample />
@@ -70,7 +72,13 @@ import SingleSelectionExample from '@site/static/usage/v7/select/basic/single-se
7072

7173
By adding the `multiple` attribute to select, users are able to select multiple options. When multiple options can be selected, the alert or popover overlay presents users with a checkbox styled list of options. The select component's value receives an array of all of the selected option values.
7274

73-
Note: the `action-sheet` interface will not work with multiple selection.
75+
:::note
76+
77+
The `action-sheet` interface is not supported with multiple selection.
78+
79+
:::
80+
81+
Keyboard interactions for multiple selection are described in the [Keyboard Interactions](#multiple-selection-1) section below.
7482

7583
import MultipleSelectionExample from '@site/static/usage/v7/select/basic/multiple-selection/index.md';
7684

@@ -86,6 +94,7 @@ import AlertExample from '@site/static/usage/v7/select/basic/single-selection/in
8694

8795
<AlertExample />
8896

97+
8998
### Action Sheet
9099

91100
import ActionSheetExample from '@site/static/usage/v7/select/interfaces/action-sheet/index.md';
@@ -257,6 +266,56 @@ import Migration from '@site/static/usage/v7/select/migration/index.md';
257266

258267
Ionic uses heuristics to detect if an app is using the modern select syntax. In some instances, it may be preferable to continue using the legacy syntax. Developers can set the `legacy` property on `ion-select` to `true` to force that instance of the input to use the legacy syntax.
259268

269+
## Accessibility
270+
271+
### Keyboard Interactions
272+
273+
Ionic's keyboard interactions follow the implementation patterns of the web instead of the native iOS select for a consistent experience across all platforms.
274+
275+
These keyboard interactions apply to all `ion-select` elements when the following conditions are met:
276+
- The select is closed.
277+
- The select is focused.
278+
- The select is not disabled.
279+
280+
|Key|Description|
281+
|----|----|
282+
|<kbd>Enter</kbd>|Opens the overlay and focuses on the first selected option. If there is no selected option, then it focuses on the first option.|
283+
|<kbd>Space</kbd>|Opens the overlay and focuses on the first selected option. If there is no selected option, then it focuses on the first option.|
284+
285+
286+
#### Single Selection
287+
288+
Single selection keyboard interaction follows the [ARIA implementation patterns of a radio](https://www.w3.org/WAI/ARIA/apg/patterns/radio/).
289+
290+
291+
These keyboard interactions apply to `ion-action-sheet`, `ion-alert`, and `ion-popover` elements when the overlay is presented and focused.
292+
293+
|Key|Description|
294+
|----|----|
295+
|<kbd>ArrowDown</kbd>|Focuses and selects the next option in the list. If there is no next option, selection will cycle to the first option.|
296+
|<kbd>ArrowLeft</kbd>|Focuses and selects the previous option in the list. If there is no previous option, selection will cycle to the last option.|
297+
|<kbd>ArrowRight</kbd>|Focuses and selects the next option in the list. If there is no next option, selection will cycle to the first option.|
298+
|<kbd>ArrowUp</kbd>|Focuses and selects the previous option in the list. If there is no previous option, selection will cycle to the last option.|
299+
|<kbd>Enter</kbd>|If an option is focused, it will select the option. Overlays **without** an 'OK' button will commit the value immediately, dismiss the overlay and return focus to the `ion-select` element.<br /><br/>If the 'OK' button is focused, it will save the user's selection, dismiss the overlay and return focus to the `ion-select` element.|
300+
|<kbd>Escape</kbd>|Closes the overlay without changing the submitted option. Returns the focus back to the `ion-select` element.|
301+
|<kbd>Space</kbd>|If the focused radio button is not checked, unchecks the currently checked radio button and checks the focused radio button. Otherwise, does nothing. If the overlay does not have an 'OK' button, the value will be committed immediately and the overlay will dismiss.|
302+
|<kbd>Tab</kbd>|Moves focus to the next focusable element (cancel button, 'OK' button, or either the selection or the first option) on the overlay. If the next focusable element is an option, then it will focus on the selected option, otherwise it will focus the first option.|
303+
304+
305+
306+
#### Multiple Selection
307+
308+
Multiple selection keyboard interaction follows the [ARIA implementation patterns of a checkbox](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/).
309+
310+
These keyboard interactions apply to `ion-alert` and `ion-popover` elements when the overlay is presented and multiple selection is enabled.
311+
312+
|Key|Description|
313+
|----|----|
314+
|<kbd>Enter</kbd>|When the 'OK' button is focused, it will save the user's selection, dismiss the overlay, and return focus to the `ion-select` element.|
315+
|<kbd>Escape</kbd>|Closes the overlay without changing the submitted option(s). Returns the focus back to the `ion-select` element.|
316+
|<kbd>Space</kbd>|Selects or deselects the currently focused option. This does not deselect the other selected options. If the overlay does not have an 'OK' button, the value will be committed immediately.|
317+
|<kbd>Tab</kbd>|Move focus to the next focusable element (cancel button, 'OK' button, or any of the options) on the overlay. If the next focusable element is the options list, then it should iterate through each option.|
318+
260319
## Properties
261320
<Props />
262321

0 commit comments

Comments
 (0)