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

[Website] Menu and Menu buttons docs #3765

Merged
merged 38 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
58c9feb
menu update
thyhmdo Oct 6, 2023
9ff3b44
Merge branch 'main' into Menu
alisonjoseph Oct 6, 2023
1ab4b73
menu update 2
thyhmdo Oct 6, 2023
636a39c
fix: mdx errors add storybookdemo
alisonjoseph Oct 6, 2023
5040f4e
Update code.mdx
alisonjoseph Oct 6, 2023
43cd9c3
menu update
thyhmdo Oct 9, 2023
56bfd60
Merge branch 'Menu' of https://github.com/thyhmdo/carbon-website into…
thyhmdo Oct 9, 2023
ebc3531
menu update
thyhmdo Oct 9, 2023
692156a
menu update
thyhmdo Oct 9, 2023
316222a
fix: styling prettier
andreancardona Oct 9, 2023
fd9900c
Update code.mdx
alisonjoseph Oct 9, 2023
e32e77a
Merge branch 'main' into Menu
alisonjoseph Oct 9, 2023
7281453
fix: empty file
alisonjoseph Oct 9, 2023
08d0025
chore: format
alisonjoseph Oct 9, 2023
157a855
fix: format
alisonjoseph Oct 9, 2023
dbaba17
menu update
thyhmdo Oct 16, 2023
dc7d06b
menu update
thyhmdo Oct 17, 2023
28b5057
Merge branch 'main' into Menu
thyhmdo Oct 17, 2023
40c91ac
menu update
thyhmdo Oct 18, 2023
2625dbf
menu update
thyhmdo Oct 18, 2023
9d30ad2
menu update after reviews
thyhmdo Oct 25, 2023
fc2b814
update menu
thyhmdo Oct 27, 2023
846c033
menu updates
thyhmdo Oct 29, 2023
faaa9e6
menu and friends updates
thyhmdo Oct 30, 2023
577abfb
menu updates
thyhmdo Oct 31, 2023
e4c33ef
menu updates
thyhmdo Oct 31, 2023
3415bc0
Merge branch 'main' into Menu
laurenmrice Oct 31, 2023
140e320
menu updates
thyhmdo Oct 31, 2023
60faac0
menu updates
thyhmdo Nov 1, 2023
07f8c5b
menu update
thyhmdo Nov 1, 2023
92385a3
menu updates
thyhmdo Nov 1, 2023
929c2eb
menu updates
thyhmdo Nov 1, 2023
d8e0f39
Merge branch 'main' into Menu
laurenmrice Nov 2, 2023
b936e0e
menu updates
thyhmdo Nov 2, 2023
5376e75
Merge branch 'Menu' of https://github.com/thyhmdo/carbon-website into…
thyhmdo Nov 2, 2023
51cb016
update again
thyhmdo Nov 2, 2023
814d390
Merge branch 'main' into Menu
laurenmrice Nov 6, 2023
56e2351
Merge branch 'main' into Menu
kodiakhq[bot] Nov 6, 2023
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
6 changes: 4 additions & 2 deletions src/data/nav-items.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@
path: /components/loading/usage/
- title: Modal
path: /components/modal/usage/
- title: Menu
path: /components/menu/usage/
- title: Menu buttons
path: /components/menu-buttons/usage/
- title: Notification
path: /components/notification/usage/
- title: Number input
path: /components/number-input/usage/
- title: Overflow menu
path: /components/overflow-menu/usage/
- title: Pagination
path: /components/pagination/usage/
- title: Popover
Expand Down
93 changes: 93 additions & 0 deletions src/pages/components/menu-buttons/accessibility.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
title: Menu buttons
description:
Menu buttons, including menu buttons, combo buttons, and overflow menus, open
a menu with a list of interactive options.
tabs: ['Usage', 'Style', 'Code', 'Accessibility']
---

import {
StructuredListWrapper,
StructuredListHead,
StructuredListBody,
StructuredListRow,
StructuredListInput,
StructuredListCell,
OrderedList,
ListItem,
} from '@carbon/react';

<PageDescription>

No accessibility annotations are needed for overflow menus, but keep these
considerations in mind if you are modifying Carbon or creating a custom
component.

</PageDescription>

<InlineNotification>

**Coming soon!** The accessibility information for the menu button and combo
button is going to be updated soon.

</InlineNotification>

<AnchorLinks>

<AnchorLink>What Carbon provides</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 keyboard. Carbon also incorporates other
accessibility considerations, some of which are described below.

### Keyboard interaction

Each overflow menu is in the tab order and is activated by `Space` or `Enter`.
When the menu is open, the first item takes focus. Focus is moved between menu
items with the `Up` and `Down` arrow keys. `Space` or `Enter` activates the item
with focus (which causes focus to go somewhere else and the menu to close).
`Esc` collapses the menu and puts focus onto the menu button.

<Row>
<Column colLg={8}>

![example of overflow menu keyboard interaction](images/overflow-menu-accessibility-1.png)

<Caption>
Overflow menus are reached by Tab. Space and Enter keys open the menu as well
as activating menu items with focus.
</Caption>

</Column>
</Row>

<Row>
<Column colLg={8}>

![illustration showing an open menu with the focus on the first item, and the arrow and Esc keys called out](images/overflow-menu-accessibility-2.png)

<Caption>
When opened, the first item in the menu takes focus. Arrow keys move focus,
Esc closes the menu.
</Caption>

</Column>
</Row>

## Development considerations

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

- Overflow menus are buttons with `aria-haspopup` set to "true".
- The overflow menu is named with `aria-label`.
- Each menu item is an `li` in a `ul`.
- Each list item contains a button with `role="menuitem"` and `tabindex="-1"`.
See the
[ARIA authoring practices on menubutton](https://w3c.github.io/aria-practices/#menubutton)
for more considerations.
181 changes: 181 additions & 0 deletions src/pages/components/menu-buttons/code.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
---
title: Menu buttons

tabs: ['Usage', 'Style', 'Code', 'Accessibility']
---

<PageDescription>

Preview the menu button, combo button, and overflow menu component with the
React live demo. For detailed code usage documentation, see the Storybooks for
each framework below.

</PageDescription>

## Documentation

### Menu button

<Row className="resource-card-group">
<Column colLg={4} colMd={4} noGutterSm>
<ResourceCard
subTitle="React"
href="https://react.carbondesignsystem.com/?path=/docs/components-menubutton--overview"
>

<MdxIcon name="react" />

</ResourceCard>
</Column>
<Column colLg={4} colMd={4} noGutterSm>
<ResourceCard
subTitle="Web Components coming soon"
disabled
href=""
>

<MdxIcon name="webcomponents" />

</ResourceCard>
</Column>
<Column colLg={4} colMd={4} noGutterSm>
<ResourceCard
subTitle="Angular (Community) coming soon"
disabled
href=""
>

<MdxIcon name="angular" />

</ResourceCard>
</Column>
<Column colLg={4} colMd={4} noGutterSm>
<ResourceCard
subTitle="Vue (Community) coming soon"
disabled
href=""
>

<MdxIcon name="vue" />

</ResourceCard>
</Column>
</Row>

### Combo button

<Row className="resource-card-group">
<Column colLg={4} colMd={4} noGutterSm>
<ResourceCard
subTitle="React"
href="https://react.carbondesignsystem.com/?path=/docs/components-combobutton--overview"
>

<MdxIcon name="react" />

</ResourceCard>
</Column>
<Column colLg={4} colMd={4} noGutterSm>
<ResourceCard
subTitle="Web Components coming soon"
disabled
href=""
>

<MdxIcon name="webcomponents" />

</ResourceCard>
</Column>
<Column colLg={4} colMd={4} noGutterSm>
<ResourceCard
subTitle="Angular (Community) coming soon"
disabled
href=""
>

<MdxIcon name="angular" />

</ResourceCard>
</Column>
<Column colLg={4} colMd={4} noGutterSm>
<ResourceCard
subTitle="Vue (Community) coming soon"
disabled
href=""
>

<MdxIcon name="vue" />

</ResourceCard>
</Column>
</Row>

### Overflow menu

<Row className="resource-card-group">
<Column colLg={4} colMd={4} noGutterSm>
<ResourceCard
subTitle="React"
href="https://react.carbondesignsystem.com/?path=/docs/components-overflowmenu--overview"
>

<MdxIcon name="react" />

</ResourceCard>
</Column>
<Column colLg={4} colMd={4} noGutterSm>
<ResourceCard
subTitle="Web Components coming soon"
disabled
href=""
>

<MdxIcon name="webcomponents" />

</ResourceCard>
</Column>
<Column colLg={4} colMd={4} noGutterSm>
<ResourceCard
subTitle="Angular (Community) coming soon"
disabled
href=""
>

<MdxIcon name="angular" />

</ResourceCard>
</Column>
<Column colLg={4} colMd={4} noGutterSm>
<ResourceCard
subTitle="Vue (Community) coming soon"
disabled
href=""
>

<MdxIcon name="vue" />

</ResourceCard>
</Column>
</Row>

## Live demo

<StorybookDemo
themeSelector
url="https://react.carbondesignsystem.com"
short
variants={[
{
label: 'Menu button',
variant: 'components-menubutton--default',
},
{
label: 'Combo button',
variant: 'components-combobutton--default',
},
{
label: 'Overflow menu',
variant: 'components-overflowmenu--default',
},
]}
/>
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading