-
Notifications
You must be signed in to change notification settings - Fork 793
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Website] Menu and Menu buttons docs (#3765)
* menu update * menu update 2 * fix: mdx errors add storybookdemo * Update code.mdx * menu update * menu update * menu update * fix: styling prettier * Update code.mdx * fix: empty file * chore: format * fix: format * menu update * menu update * menu update * menu update after reviews * update menu * menu updates * menu and friends updates * menu updates * menu updates * menu updates * menu updates * menu update * menu updates * menu updates * menu updates * update again --------- Co-authored-by: Alison Joseph <[email protected]> Co-authored-by: Alison Joseph <[email protected]> Co-authored-by: Andrea N. Cardona <[email protected]> Co-authored-by: Lauren Rice <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b166f61
commit 609aef2
Showing
90 changed files
with
1,888 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
]} | ||
/> |
File renamed without changes
File renamed without changes
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.
Binary file added
BIN
+40.6 KB
src/pages/components/menu-buttons/images/style-structure-combo-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.4 KB
src/pages/components/menu-buttons/images/style-structure-menu-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+121 KB
...omponents/menu-buttons/images/usage-menu-alignment-menu-button-alternatives.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+90.1 KB
...ges/components/menu-buttons/images/usage-menu-alignment-menu-button-default.png
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.
Binary file added
BIN
+188 KB
src/pages/components/menu-buttons/images/usage-menu-button-anatomy.png
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.
Binary file added
BIN
+130 KB
src/pages/components/menu-buttons/images/usage-menu-button-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+71.3 KB
src/pages/components/menu-buttons/images/usage-menu-combo-button-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+64.9 KB
src/pages/components/menu-buttons/images/usage-menu-combo-button-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+107 KB
src/pages/components/menu-buttons/images/usage-menu-combo-button-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39 KB
src/pages/components/menu-buttons/images/usage-menu-ghost-button-width-do.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38 KB
src/pages/components/menu-buttons/images/usage-menu-ghost-button-width-dont.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+52.9 KB
src/pages/components/menu-buttons/images/usage-menu-keyboard-combo-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+71.9 KB
src/pages/components/menu-buttons/images/usage-menu-keyboard-menu-button.png
Oops, something went wrong.
Binary file added
BIN
+58.2 KB
src/pages/components/menu-buttons/images/usage-menu-mouse-combo-button.png
Oops, something went wrong.
Binary file added
BIN
+68.6 KB
...ages/components/menu-buttons/images/usage-menu-mouse-keyboard-overflow-menu.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+152 KB
src/pages/components/menu-buttons/images/usage-menu-width-menu-button-default.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+43.3 KB
src/pages/components/menu-buttons/images/usage-sizing-height-dont.png
Oops, something went wrong.
Oops, something went wrong.
609aef2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
carbondesignsystem – ./
carbondesignsystem-carbon-design-system.vercel.app
carbondesignsystem-git-main-carbon-design-system.vercel.app
carbondesignsystem.vercel.app