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

docs(SelectPanel): update docs with keyboard interactions #2335

Merged
merged 10 commits into from
Oct 10, 2022
83 changes: 82 additions & 1 deletion docs/content/SelectPanel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,85 @@ function DemoComponent() {
render(<DemoComponent />)
```

## Component props
## Accessibility

### Keyboard

Pressing `Enter` or `Space` on the `SelectPanel` anchor will
open the `SelectPanel` and place focus on the filter input. Pressing `Escape` or interacting with the cancel or close buttons will close the `SelectPanel` and restore focus to the anchor.

A user may use `Tab` and `Shift+Tab` to navigate between the filter input, list of
items, action buttons, and the close button.

When focus is on the list of items, pressing `ArrowDown` and `ArrowUp` will allow navigation between items. Support for `Home` and `End` is also provided to quickly navigate to the first and last items in the list, respectively. Pressing `Space` will select an item.

The `Enter` key may be used when focus is within the `SelectPanel` as an
alternative to activating the save button.

## Props

### SelectPanel

<!-- TODO: add remaining props -->

<PropsTable>
joshblack marked this conversation as resolved.
Show resolved Hide resolved
<PropsTableRow
name="onOpenChange"
type={`(
open: boolean,
gesture:
| 'anchor-click'
| 'anchor-key-press'
| 'click-outside'
| 'escape'
| 'selection'
) => void`}
required
/>
<PropsTableRow name="placeholder" type="string" />
<PropsTableRow
name="overlayProps"
type="Partial<OverlayProps>"
description={
<>
See <a href="/react/Overlay#props">Overlay props</a>.
</>
}
/>
joshblack marked this conversation as resolved.
Show resolved Hide resolved
<PropsTableRow name="title" type="string" />
<PropsTableRow name="inputLabel" type="string" />
<PropsTableRow name="inputPlaceholder" type="string" />

<PropsTableRow
name="selected"
type="ItemInput | ItemInput[] | undefined"
description="Specify the selected item(s)"
/>
<PropsTableRow
name="onSelectedChange"
type="(selected: ItemInput | ItemInput[]) => void"
description="Provide a callback called when the selected item(s) change"
/>

</PropsTable>
joshblack marked this conversation as resolved.
Show resolved Hide resolved

## Status

<ComponentChecklist
items={{
propsDocumented: false,
noUnnecessaryDeps: true,
adaptsToThemes: true,
adaptsToScreenSizes: true,
fullTestCoverage: false,
usedInProduction: true,
usageExamplesDocumented: false,
hasStorybookStories: false,
designReviewed: false,
a11yReviewed: false,
stableApi: false,
addressedApiFeedback: false,
hasDesignGuidelines: false,
hasFigmaComponent: false
}}
/>