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] Small changes to standardize acessibility section for Data Grid and Tree View #13224

10 changes: 6 additions & 4 deletions docs/data/data-grid/accessibility/accessibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,19 @@ renderCell: (params) => (

### Navigation

:::info
The following key assignments apply to Windows and Linux users.

On macOS:
On macOS replace:

- replace <kbd class="key">Ctrl</kbd> with <kbd class="key">⌘ Command</kbd>
- replace <kbd class="key">Alt</kbd> with <kbd class="key">⌥ Option</kbd>
- <kbd class="key">Ctrl</kbd> with <kbd class="key">⌘ Command</kbd>
- <kbd class="key">Alt</kbd> with <kbd class="key">⌥ Option</kbd>
:::

| Keys | Description |
| -----------------------------------------------------------------: | :---------------------------------------------------------- |
| <kbd class="key">Arrow Left</kbd> | Navigate between cell elements |
| <kbd class="key">Arrow Bottom</kbd> | Navigate between cell elements |
| <kbd class="key">Arrow Down</kbd> | Navigate between cell elements |
Copy link
Member

@flaviendelangle flaviendelangle May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The famous "Arrow Bottom" 😆

| <kbd class="key">Arrow Right</kbd> | Navigate between cell elements |
| <kbd class="key">Arrow Up</kbd> | Navigate between cell elements |
| <kbd class="key">Home</kbd> | Navigate to the first cell of the current row |
Expand Down
71 changes: 71 additions & 0 deletions docs/data/date-pickers/accessibility/accessibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
productId: x-date-pickers
title: Date and Time Pickers - Date format and localization
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intend to add this page on this PR? 🤔
If so, then this title should better reflect the page content and maybe we'd need to adjust the PR title. 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like I did something wrong 🙈

githubLabel: 'component: pickers'
packageName: '@mui/x-date-pickers'
---

# Date and Time Pickers - Accessibility

<p class="description">The Date and Time Pickers have complete accessibility support, including built-in keyboard navigation that follows international standards.</p>

## Guidelines

The most commonly encountered conformance guidelines for accessibility are:

- Globally accepted standard: [WCAG](https://www.w3.org/WAI/standards-guidelines/wcag/)
- US:
- [ADA](https://www.ada.gov/) - US Department of Justice
- [Section 508](https://www.section508.gov/) - US federal agencies
- Europe: [EAA](https://ec.europa.eu/social/main.jsp?catId=1202) (European Accessibility Act)

WCAG 2.1 has three levels of conformance: A, AA, and AAA.
Level AA meets the most commonly encountered conformance guidelines.
This is the most common target for organizations so what we aims to support very well.

<!-- Those examples do not cover the clock component -->
The WAI-ARIA Authoring Practices includes examples on [Date Picker Dialog](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/examples/datepicker-dialog/) and [Date Picker Spin Button](https://www.w3.org/WAI/ARIA/apg/patterns/spinbutton/examples/datepicker-spinbuttons/) that provide valuable information on how to optimize the accessibility of the Date and Time Pickers.

## Keyboard support

The Date and Time Pickers consist on different associations of Field, Calendar, Time and Digital Clock components, each of which listens for keyboard interactions from the user and emits events in response to the pressed keys.

:::info
The following key assignments apply to Windows and Linux users.

On macOS:

- replace <kbd class="key">Ctrl</kbd> with <kbd class="key">⌘ Command</kbd>
- replace <kbd class="key">Alt</kbd> with <kbd class="key">⌥ Option</kbd>

:::

### Field components

| Keys | Description |
| -----------------------------------------------------------------: | :---------------------------------------------------------- |
| <kbd class="key">Arrow Left</kbd> | Moves focus among date/time sections |
| <kbd class="key">Arrow Right</kbd> | Moves focus among date/time sections |
| <kbd class="key">Arrow Up</kbd> | Increases focused section value by 1 |
| <kbd class="key">Arrow Down</kbd> | Decreases focused section value section by 1 |
| <kbd class="key">Page Up</kbd> | Increases focused section value section by 5 |
| <kbd class="key">Page Down</kbd> | Decreases focused section value section by 5 |
| <kbd class="key">Home</kbd> | Sets focused section to the first value |
| <kbd class="key">End</kbd> | Sets focused section to the last value |

### Calendar component

| Keys | Description |
| -----------------------------------------------------------------: | :---------------------------------------------------------- |
| <kbd class="key">Arrow Left</kbd> | Moves focus among date/time sections |
| <kbd class="key">Arrow Right</kbd> | Moves focus among date/time sections |
| <kbd class="key">Arrow Up</kbd> | Increases focused section value by 1 |
| <kbd class="key">Arrow Down</kbd> | Decreases focused section value section by 1 |
| <kbd class="key">Page Up</kbd> | Increases focused section value section by 5 |
| <kbd class="key">Page Down</kbd> | Decreases focused section value section by 5 |
| <kbd class="key">Home</kbd> | Sets focused section to the first value |
| <kbd class="key">End</kbd> | Sets focused section to the last value |

## API

- [DateTime](/x/api/date-pickers/)
4 changes: 2 additions & 2 deletions docs/data/tree-view/accessibility/accessibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ The [WAI-ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/patterns/tree
:::info
The following key assignments apply to Windows and Linux users.

On macOS replace <kbd class="key">Ctrl</kbd> with <kbd class="key">⌘ Command</kbd>.

On macOS replace:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how correct we are here. 🤔
Those keys definitely exist on MacOS and their keyboards:
https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/MQ052?wid=2000&hei=2000&fmt=jpeg&qlt=95&.v=1495129815011
It's only MacBooks with their limited amount of keys or any other keyboard with less keys, which remove less often used keys. 🤔
So, technically, with this we are educating users about MacOS shortcuts for keys that they MIGHT not have on their keyboard.
I'm not saying that we can't do it. Just questioning if maybe we could put a bit less emphasis on it and instead only link to a MacOS keyboard shortcut page? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes total sense for me, I confess I had the idea to add it based on my personal experience with the macbook and didn't consider other MacOS devices.
Maybe we could divide it into 2 info dialogs:

  • for keys that are necessarily different, like command
  • for keys that might be different, like pageUp
    The second one could have a sentence briefly mentioning that some devices might demand the usage of equivalent key combinations, WDYT ?

Anyways, we can split the PR: I will remove those mentions on this PR and let only the small corrections that don't rely on it, while we continue the discussion :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense, we can definitely put those additions as improvements that would have less emphasis than actually different buttons. 👍

- <kbd class="key">Ctrl</kbd> with <kbd class="key">⌘ Command</kbd>.
:::

| Keys | Description |
Expand Down
7 changes: 7 additions & 0 deletions docs/pages/x/react-date-pickers/accessibility.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as React from 'react';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from 'docsx/data/date-pickers/accessibility/accessibility.md?muiMarkdown';

export default function Page() {
return <MarkdownDocs {...pageProps} />;
}