Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pagination accessibility update #3224

Merged
merged 7 commits into from
Nov 2, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(format): fix format error
  • Loading branch information
tw15egan committed Oct 28, 2022
commit b5fc65f67fbe42c81298789b1bbd9a2a2c4fdbe4
32 changes: 24 additions & 8 deletions src/pages/components/pagination/accessibility.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,53 +41,69 @@ other accessibility considerations, some of which are described below.

### Keyboard interaction

The tab order goes from left to right through the controls in the pagination component. On focus, the dropdowns are opened with `Space` or with up or down arrows, which also cycle through the values. Both `Space` and `Enter` select a value and close the dropdown. The dropdown can also be closed by pressing `Esc`. The previous and next page arrow buttons are activated by `Space` or `Enter` keys.
The tab order goes from left to right through the controls in the pagination
component. On focus, the dropdowns are opened with `Space` or with up or down
arrows, which also cycle through the values. Both `Space` and `Enter` select a
value and close the dropdown. The dropdown can also be closed by pressing `Esc`.
The previous and next page arrow buttons are activated by `Space` or `Enter`
keys.

<Row>
<Column colLg={8}>

![example of tabbing into a pagination group and arrowing between selections](images/pagination-accessibility-1.png)

<Caption>
Interactive elements in pagination maintain their usual Carbon keyboard behaviors and tab order.
Interactive elements in pagination maintain their usual Carbon keyboard
behaviors and tab order.
</Caption>

</Column>
</Row>

When the pagination is at either end of its range, one of the page navigation buttons becomes invalid. When that happens, the button is no longer navigable or operable, like any other disabled control.
When the pagination is at either end of its range, one of the page navigation
buttons becomes invalid. When that happens, the button is no longer navigable or
operable, like any other disabled control.

<Row>
<Column colLg={8}>

![tab order bypasses the disabled left-arrow icon](images/pagination-accessibility-2.png)

<Caption>
The prior page button is disabled and unreachable when the pagination is at the start of its range.
The prior page button is disabled and unreachable when the pagination is at
the start of its range.
</Caption>

</Column>
</Row>

### Labeling

Not all the elements in pagination have static or visually isolated labels. Carbon constructs a programmatic name for the second dropdown by concatenating some dynamically generated text on the screen. Carbon also provides accessible names for the icon-only buttons.
Not all the elements in pagination have static or visually isolated labels.
Carbon constructs a programmatic name for the second dropdown by concatenating
some dynamically generated text on the screen. Carbon also provides accessible
names for the icon-only buttons.

<Row>
<Column colLg={8}>

![illustration showing labels for dropdown and icon-only buttons](images/pagination-accessibility-3.png)

<Caption>
Carbon provides the accessible names "page number, of 3 pages", "previous page", and "next page" for assistive technology.
Carbon provides the accessible names "page number, of 3 pages", "previous
page", and "next page" for assistive technology.
</Caption>

</Column>
</Row>

## Development considerations

Keep these considerations in mind if you are modifying Carbon or creating a custom component.
Keep these considerations in mind if you are modifying Carbon or creating a
custom component.

- Carbon uses `<select>` elements for the dropdowns
- Consult the [ARIA authoring practices](https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html) for more considerations.
- Consult the
[ARIA authoring practices](https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html)
for more considerations.