Skip to content

Commit 0b10b48

Browse files
committed
refactor(docs): improve accessibility descriptions across components
- Enhanced accessibility descriptions for various components including Alert Dialog, Aspect Ratio, Card, Carousel, Chart, Collapsible, Combobox, Context Menu, Dialog, Drawer, Field, Hover Card, Input Group, Input, Label, Menubar, Native Select, Navigation Menu, Radio Input, Resizable, Scroll Area, Separator, Sheet, Sidebar, and Slider. - Focused on clarity and usability by refining keyboard support, screen reader guidance, and semantic structure for better user experience.
1 parent a284ef4 commit 0b10b48

26 files changed

+146
-108
lines changed

apps/docs/content/components/alert-dialog.mdx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ See [Modal](https://react-aria.adobe.com/Modal) reference for more information.
217217

218218
## Accessibility
219219

220-
- **Role**: Uses `role="alertdialog"` to ensure screen readers treat it as an interruptive modal.
221-
- **Focus Management**: Automatically handles focus entrapment and returns focus to the trigger upon closing.
222-
- **Keyboard Navigation**: Supports `Escape` key to close the dialog and `Enter` to trigger actions.
223-
- **Aria Labels**: Titles and descriptions are automatically linked to the dialog container for context.
220+
- **Focus management:** The alert dialog keeps focus within it while open and returns focus to the trigger when it closes.
221+
- **Keyboard support:** Users can press the `Escape` key to close the dialog and press `Enter` to confirm the primary action.
222+
- **Trigger behavior:** Users can open the alert dialog using a trigger and interact with actions using the mouse or keyboard.
223+
- **Screen reader support:** Screen readers announce the dialog as an alert, so users understand that immediate action is required.
224+
- **ARIA labeling:** Use `AlertDialogTitle` and `AlertDialogDescription` to describe the purpose and impact of the action clearly.
225+
- **Action clarity:** Provide clear labels for actions like confirm and cancel so users understand the outcome before proceeding.

apps/docs/content/components/aspect-ratio.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ The AspectRatio component works seamlessly with responsive images. Use `object-c
125125

126126
## Accessibility
127127

128-
- **Semantic HTML**: The component uses a standard `<div>` element that can be enhanced with ARIA attributes as needed.
129-
- **Image Alt Text**: When using images, always provide descriptive `alt` text for screen readers.
130-
- **Focus Management**: The component forwards refs, allowing you to manage focus programmatically when needed.
131-
- **Responsive Design**: Aspect ratios are maintained across all screen sizes, ensuring consistent presentation for all users.
128+
- **Semantic structure:** The component uses a standard `<div>`. Add semantic elements inside it when needed, such as `<img>`, `<video>`, or `<iframe>`.
129+
- **Alt text for images:** Always provide a clear `alt` attribute when using images so screen readers can understand the content.
130+
- **Focus handling:** The component forwards refs, so you can manage focus if the content inside is interactive.
131+
- **Responsive behavior:** The aspect ratio stays consistent across screen sizes, so content does not shift or break layout.

apps/docs/content/components/card.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ The footer of the card.
248248

249249
## Accessibility
250250

251-
- **Semantic Structure**: Use `CardTitle` (which renders a div by default, but can be customized) for headings to seek user attention.
252-
- **Grouping**: Cards naturally group related content. For complex cards, ensure the `CardTitle` properly describes the card's purpose.
253-
- **Keyboard Navigation**: Ensure any interactive elements within the card (buttons, links in `CardFooter` or `CardContent`) are keyboard accessible.
251+
- **Semantic structure:** Use `CardTitle` for headings and structure content clearly so users can understand what the card represents.
252+
- **Content grouping:** The card groups related content and actions together, making it easier to scan and understand.
253+
- **Keyboard support:** Ensure any interactive elements inside the card (such as buttons or links in `CardFooter` or `CardContent`) are accessible using the keyboard.
254+
- **Screen reader support:** Provide clear text for titles, descriptions, and actions so screen readers can describe the card content properly.

apps/docs/content/components/carousel.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ See the [Embla Cacrousel Guides](https://www.embla-carousel.com/guides/) for mor
187187

188188
## Accessibility
189189

190-
- Use the [Embla Carousel Accessibility](https://www.embla-carousel.com/plugins/accessibility/) plugin for best accessibility support.
191-
- Built with keyboard navigation support (Arrow keys automatically scroll items).
192-
- Uses `role="region"` with `aria-roledescription="carousel"` for the outer container.
193-
- Each slide has `role="group"` and `aria-roledescription="slide"`.
194-
- Buttons include `sr-only` text for screen readers ("Previous slide", "Next slide").
195-
- Properly handles `disabled` states when the carousel cannot scroll further.
190+
- **Keyboard support:** Users can navigate between slides using `Arrow` keys.
191+
- **Screen reader support:** Navigation buttons include hidden text like “Previous slide” and “Next slide” so screen readers can announce them clearly.
192+
- **ARIA roles:** The carousel uses roles like `region` (carousel) and `group` (slide) to help screen readers understand the structure.
193+
- **Slide structure:** Each slide is treated as a separate group so users can identify slide boundaries.
194+
- **Navigation states:** Navigation buttons are `disabled` when there are no more slides to scroll.
195+
- **Accessibility plugins:** You can use the Embla accessibility plugin to enhance support for screen readers and interactions.

apps/docs/content/components/chart.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,12 @@ Extends Recharts `DefaultLegendContentProps`.
178178
| `hideIndicator` | `boolean` | `false` | Whether to hide the color indicator shape next to legend items. |
179179
| `className` | `string` | - | Additional CSS classes for the legend container. |
180180

181-
## Accessibility
182-
183181
The Chart components are designed with accessibility in mind, ensuring that data visualizations are perceivable and navigable.
184182

185-
- **Focus Management**: The `ChartContainer` includes keyboard-accessible styles for the underlying Recharts wrapper, providing clear visual indicators when the component receives focus.
186-
- **Dynamic Indicators**: Customizable indicators (`dot`, `line`, `square`) help differentiate data series, making them easier to identify for users with visual impairments.
187-
- **ARIA Support**: Leverages Recharts' built-in ARIA support for SVG elements, providing semantic roles and labels to assistive technologies.
188-
- **Screen Readers**: Descriptive tooltips and legends ensure that data values are correctly announced when interacted with.
183+
## Accessibility
184+
185+
- **Focus management:** The chart can receive focus and shows clear visual indicators when it is active.
186+
- **Screen reader support:** Tooltips and legends help screen readers describe data values.
187+
- **Data clarity:** Use clear labels, legends, and axis titles so users can easily understand the data.
188+
- **Visual distinction:** Different colors and indicator styles (dot, line, square) help users distinguish between data series.
189+
- **ARIA support:** The chart uses accessible SVG elements and roles provided by Recharts.

apps/docs/content/components/collapsible.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ The panel is hidden from the accessibility tree when collapsed. React Aria handl
218218

219219
## Accessibility
220220

221-
- **Semantics** — The trigger is a `<button>` inside a heading element (`h3` by default). This creates the correct heading hierarchy for screen readers.
222-
- **ARIA attributes** `aria-expanded` and `aria-controls` are automatically managed by React Aria. No manual wiring required.
223-
- **Keyboard support** — Press `Space` or `Enter` on the focused trigger to expand or collapse the panel.
224-
- **Focus management** — Focus styles are visible when navigating by keyboard (`focus-visible`).
225-
- **Disabled state** When `isDisabled` is set, the trigger receives `disabled` and is removed from the tab order.
226-
- **Heading level** — Use the `level` prop on `CollapsibleTrigger` to match the heading hierarchy of the surrounding page content.
221+
- **Keyboard support:** Users can press `Enter` or `Space` on the trigger to expand or collapse the content.
222+
- **Focus management:** The trigger can receive focus, and focus styles appear when navigating with the keyboard.
223+
- **ARIA behavior:** The component automatically manages expanded (`aria-expanded`) and collapsed states so screen readers know when content is visible.
224+
- **Semantic structure:** The trigger is rendered as a button within a heading, helping screen readers understand the content hierarchy.
225+
- **Content visibility:** When collapsed, the content is hidden from assistive technologies and becomes available when expanded.
226+
- **Disabled state:** When `disabled`, the trigger cannot be focused or activated.

apps/docs/content/components/combobox.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ The `Key` type supports `string` and `number`. See [React Aria's Combobox](https
356356

357357
## Accessibility
358358

359-
- **Keyboard Navigation**: Supports arrow keys to navigate options, Enter/Space to select, and Escape to close.
360-
- **Filtering**: Type to filter the list of options dynamically.
361-
- **Screen Readers**: Follows W3C ARIA ComboBox design pattern with proper descriptions and state announcements.
362-
- **Focus Management**: Maintains focus within the input while navigating the listbox.
359+
- **Keyboard support:** Users can navigate options using `Arrow` keys, select an option with `Enter`, and close the list with `Escape`.
360+
- **Search and filtering:** As users type in the input, the list updates to show matching results.
361+
- **Focus management:** Focus stays on the input while users navigate the list.
362+
- **Selection behavior:** Supports single and multiple selection depending on configuration.
363+
- **Label and description:** Provide a label and optional description so users understand the purpose of the input.

apps/docs/content/components/command.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ A visual divider between items or groups.
244244

245245
## Accessibility
246246

247-
- **Keyboard Navigation**: Use arrow keys to navigate between items.
248-
- **Filtering**: Items are automatically filtered based on input.
249-
- **Screen Reader Support**: Properly labeled with ARIA attributes.
247+
- **Keyboard support:** Users can navigate between items using the `Arrow` keys and select an item using `Enter`.
248+
- **Search and filtering:** As users type, the list updates to show matching results.
249+
- **Focus management:** Focus moves from the input to the list and between items, making it usable with the keyboard.
250+
- **Dialog behavior:** When used with `CommandDialog`, users can open it with shortcuts such as `Ctrl + J` or `Cmd + J`, and close it with `Escape`.
251+
- **Screen reader support:** Use clear labels and text for items so screen readers can announce commands and groups properly.

apps/docs/content/components/context-menu.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,9 @@ A decorative element used to display keyboard shortcuts.
330330

331331
## Accessibility
332332

333-
- Full keyboard navigation support (arrow keys, Enter, Escape).
334-
- Correct ARIA roles and attributes automatically applied via Base UI.
335-
- Support for type-ahead selection.
336-
- Managed focus restoration on menu close.
337-
- Long-press support on touch devices.
333+
- **Semantic structure:** The component uses proper menu roles like `menu` and `menuitem`, so screen readers can understand the structure.
334+
- **Keyboard support:** Users can move between items using `Arrow` keys, open items with `Enter` or `Space`, and close the menu with `Escape`.
335+
- **Focus management:** Focus moves correctly between menu items and submenus, and returns to the trigger when the menu is closed.
336+
- **Trigger behavior:** The menu opens on right-click or long-press, and also works with keyboard interaction.
337+
- **Screen reader support:** Active and selected items are announced clearly, including nested menus and grouped items.
338+
- **Disabled items:** Disabled items are skipped during keyboard navigation and are announced properly.

apps/docs/content/components/dialog.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,9 @@ A button with `slot="close"` that automatically closes the nearest dialog when p
335335

336336
## Accessibility
337337

338-
- **Focus Management**: Focus is automatically trapped inside the dialog when open and restored to the trigger on close.
339-
- **Keyboard Support**: Press `Escape` to close the dialog (configurable via `isKeyboardDismissDisabled` on `DialogOverlay`).
340-
- **ARIA Labelling**: `DialogTitle` uses `slot="title"` to automatically set `aria-labelledby` on the dialog.
341-
- **Screen Readers**: The dialog is announced as a modal overlay, and background content is hidden from assistive technology.
342-
- **Dismiss on Outside Click**: Clicking the overlay backdrop closes the dialog when `isDismissable` is `true` on `DialogOverlay`.
343-
- **Semantic HTML**: Uses native `dialog` semantics via react-aria-components for maximum compatibility.
338+
- **Focus management:** The dialog keeps focus while open and returns focus to the trigger when it closes.
339+
- **Keyboard support:** Users can press the `Escape` key to close the dialog. You can turn off this behavior if needed.
340+
- **Trigger behavior:** Users can open and close the dialog using a trigger or a close button with a mouse or keyboard.
341+
- **Screen reader support:** Screen readers announce the dialog as a modal, and background content stays hidden while it is open.
342+
- **ARIA labeling:** Use `DialogTitle` and `DialogDescription` to describe the dialog content clearly.
343+
- **Outside click:** Users can close the dialog by clicking outside when `isDismissable` is enabled.

0 commit comments

Comments
 (0)