diff --git a/.storybook/preview-head.html b/.storybook/preview-head.html index fade5f67f7..32d6cf8ca1 100644 --- a/.storybook/preview-head.html +++ b/.storybook/preview-head.html @@ -22,6 +22,13 @@ padding-bottom: 16px; } + /* Match the Component API tables: opaque cells hide Storybook's zebra striping so inline `code` + (same color as the stripe) stays distinguishable in MDX tables. */ + .sbdocs-content table:not([class]) th, + .sbdocs-content table:not([class]) td { + background-color: var(--cnvs-sys-color-bg-default); + } + .cnvs-title-status-indicator { margin-left: 16px; vertical-align: middle; diff --git a/modules/react/action-bar/stories/ActionBar.mdx b/modules/react/action-bar/stories/ActionBar.mdx index 242c8a4a49..42d65d2e8f 100644 --- a/modules/react/action-bar/stories/ActionBar.mdx +++ b/modules/react/action-bar/stories/ActionBar.mdx @@ -1,11 +1,13 @@ import {Meta} from '@storybook/blocks'; + import {ExampleCodeBlock, SymbolDoc} from '@workday/canvas-kit-docs'; + +import ActionBarStoriesMeta from './ActionBar.stories'; import {Basic} from './examples/Basic'; -import {Icons} from './examples/Icons'; import {DeleteAction} from './examples/DeleteAction'; +import {Icons} from './examples/Icons'; import {OverflowActionBar} from './examples/OverflowActionBar'; import {OverflowActionBarCustomButtonCount} from './examples/OverflowActionBarCustomButtonCount'; -import ActionBarStoriesMeta from './ActionBar.stories'; @@ -75,13 +77,144 @@ You can change it from the default of 3 to any number greater than 1 and less th ## Accessibility -Grouping the actions into an HTML `
` element with an `aria-label` string is recommended. -This can be useful for helping screen reader users quickly jump down to the actions at the bottom of -a page. +The primary accessibility goal is a clearly named group of page-level actions where every action is +a native, keyboard-operable button. Use Action Bar for the primary and secondary actions of a page +or task. For a single action, use a [Button](/components/buttons/button/#accessibility) directly. +For a dense set of icon or dropdown controls that behaves as one tab stop, use +[Toolbar](https://workday.github.io/canvas-kit/?path=/docs/components-buttons-toolbar--docs). For +actions that open a task flow, compose [Modal](/components/popups/modal/#accessibility) or +[Dialog](/components/popups/dialog/#accessibility) from an **`ActionBar.Item`**. + +See the [Menu Button pattern (APG)](https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/), the +[Button pattern (APG)](https://www.w3.org/WAI/ARIA/apg/patterns/button/), and the Canvas Kit +[Accessibility overview](https://workday.github.io/canvas-kit/?path=/docs/guides-accessibility-overview--docs). + +### Minimum Accessible Structure + +The following matches the [Basic Example](#basic-example): an **`ActionBar.List`** rendered as a +labelled `section`, with a primary action first and secondary actions after it. **`ActionBar.List`** +and **`ActionBar.Item`** should always be inside **`ActionBar`**. + +```tsx +import {ActionBar} from '@workday/canvas-kit-react/action-bar'; +import {PrimaryButton} from '@workday/canvas-kit-react/button'; + + + + console.log('first action')}> + First Action + + Second Action + +; +``` -Refer to [Button](/components/buttons/button/#accessibility) and -[Menus](/components/popups/menu/#accessibility) for more information about accessibiliy of these -components in the Action Bar. +Provide a translated, descriptive **`aria-label`** on **`ActionBar.List`**. Every +**`ActionBar.Item`** needs non-empty visible text, which becomes its accessible name. + +### Built-in Behaviors + +Canvas Kit applies these automatically. **Do not duplicate them** in consuming code. + +**ARIA and DOM** (_applied by hooks/subcomponents_): + +- **`ActionBar`**: Does not render an element. It creates the model and wraps its children in + **`Menu`** so the overflow menu shares state. +- **`ActionBar.List`**: Renders a `div` by default. It has no role of its own—use `as="section"` + with **`aria-label`** to expose a landmark. It is positioned fixed to the bottom of the viewport + unless you override `position`. +- **`ActionBar.Item`**: Renders a native `