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

Update accessibility.mdx #3251

Merged
merged 15 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
65 changes: 56 additions & 9 deletions src/pages/components/tree-view/accessibility.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,66 @@ tabs: ['Usage', 'Style', 'Code', 'Accessibility']

<PageDescription>

Design annotations are needed for specific instances shown below, but for the
standard accordion component, Carbon already incorporates accessibility.
No accessibility annotations are needed for a tree view, but keep these
considerations in mind if you are modifying Carbon or creating a custom
component.

</PageDescription>

<InlineNotification>

This page is underdevelopment. Please check back later for updates.

</InlineNotification>

<AnchorLinks>
<AnchorLink>What Carbon provides</AnchorLink>
<AnchorLink>Design recommendations</AnchorLink>
<AnchorLink>Development considerations</AnchorLink>
</AnchorLinks>

## What Carbon provides

Carbon bakes keyboard operation into its components, improving the experience of
blind users and others who operate via the keyboard. Carbon incorporates many
other accessibility considerations, some of which are described below.

### Keyboard interaction

The tree view takes a single tab stop, with focusing landing on the selected
node or the first node of an unselected tree. When trees have focus, arrow keys
provide navigation. The `Right arrow` key expands a closed branch node. If a
branch is open, the `Right arrow` moves into the first child node. Pressing the
`Left arrow` key on an open branch collapses it. Left arrowing on a child moves
the focus to the parent branch. `Up` and `Down arrow` keys move vertically
through open branches and their child nodes. A node or branch is selected by
`Space` or `Enter` keys.

<Row>
<Column colLg={8}>

![tabbing into a tree, focus lands on the current item, and tabbing again leaves the tree](images/tree-view-accessibility-1.png)

<Caption>The tree view takes a single tab stop.</Caption>

</Column>
</Row>

<Row>
<Column colLg={8}>

![illustration showing keyboard interaction](images/tree-view-accessibility-2.png)

<Caption>
Arrow keys operate and move around in the nodes of a tree. Space or Enter
selects the current node.
</Caption>

</Column>
</Row>

## Development considerations

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

- The component uses a `tree` role on a `ul` with all nodes in `li` given a role
of `treeitem` with a `tabindex="-1"` and `aria-selected="false"` (except the
currently selected node).
- All branch nodes contain an `aria-expanded` attribute.
- See the
[ARIA authoring practice Tree View pattern](https://www.w3.org/WAI/ARIA/apg/patterns/treeview/)
for more considerations.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.