This repository was archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
docs(Accessibility): add accessibility spec #2237
Open
jurokapsiar
wants to merge
8
commits into
master
Choose a base branch
from
spec/accessibility
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
dd7d2df
add accessibility spec
4fd82b2
a bit better
e059810
even better
d9bc824
typos
6aabe54
Update specs/Accessibility.md
dzearing 7fbc82b
PR comments resolved
17a2d3f
overriding, extending, contrast and reflow
9e2144a
updated reflow link
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,78 @@ | ||
# Requirements | ||
|
||
## ARIA conformance | ||
In general, components need to conform to the [WAI-ARIA Authoring Practices 1.2](https://www.w3.org/TR/wai-aria-practices-1.2/). These practices are evaluated to achieve best possible user experience with supported browser/screen reader combinations. | ||
|
||
## Keyboard navigation | ||
- All elements that are interactive need to be focusable using keyboard keys (TAB/Shift+Tab or arrow keys) | ||
- Elements that have click or right-click (contextmenu) handlers need to respond to Enter/Space or secondary action shortcuts. Users need to be able to initiate the click or right click when using screen readers. | ||
- Focused element needs to be highlighted if it was focused by keyboard | ||
layershifter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- Focus should never go to the ``<body>`` element | ||
- User needs to be able to move focus at any time, focus should not be be 'stuck' on one element | ||
- In RTL mode, left arrow key moves the focus to the next focusable element, right arrow key moves the focus to the previous focusable element within the focus zone. | ||
|
||
## Focus | ||
- Whenever possible, focus should land only on elements that have concrete implicit or explicit ARIA role (`<button />`, `role='button'`, `role='menuitem'`, ....) | ||
- onClick event handlers need to be handled on focusable elements with implicit or explicit ARIA role and not on their parent/child elements | ||
- When reacting on focus or on hover screen reader interaction needs to be specified. Some screen readers do not have concept of hovering and not always focus elements, so there needs to be another way for the screen reader users to interact with such elements. For example showing popups on focus or on hover needs to be justified and alternative interaction compatible with the screen readers need to be provided | ||
jurokapsiar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Screen reader support | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be helpful to add guidance for scan mode or at least warnings of lack of scan mode support because a lot of issues coming in currently are regarding this special feature of Narrator (which since it is a Microsoft AT users expect our controls to work with it fully). |
||
User needs to be able to interact with the application using: | ||
- screen reader with virtual cursor navigation (browse mode) | ||
- screen reader without virtual cursor navigation (application mode) | ||
|
||
All requirements for keyboard navigation are valid in both of these screen reader use cases. User needs to be able to understand which element is focused and how he can interact with it just based on the information provided by the screen reader. | ||
|
||
Following combinations of clients and screen readers is supported/required: | ||
- Windows/Chrome - JAWS, NVDA | ||
- Windows/Edge - Narrator | ||
jurokapsiar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- Windows/Firefox - NVDA | ||
- macOS/Chrome - VoiceOver | ||
jurokapsiar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Contrast | ||
- There has to be sufficient contrast between background and foreground of the component (text, icon...) in all component states and themes. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could use more info, links to specs etc |
||
|
||
## Zoom | ||
- Elements need to be rendered correctly when zoomed up to 400% | ||
khmakoto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Components and Behaviors | ||
There are two areas that come together to achieve accessibility: | ||
* Components - implemented for each supported framwork (currently React), when rendered, need to be [semantically correct](https://en.wikipedia.org/wiki/Semantic_HTML) | ||
dzearing marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* Behaviors - framework independent, intended to add ARIA roles, ARIA attributes and keyboard handling on top of the components based on their type and state. In the future, behaviors development will move from the [Stardust react](https://github.com/stardust-ui/react) repo to [Stardust accessibility](https://github.com/stardust-ui/accessibility) repo. | ||
jurokapsiar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
**Accessibility behaviors** reflect the need to have a set of validated and carefully tested alternatives available for the consumers that guarantee the accessibility of the component in various use cases. In some cases, accessibility can be highly oppinionated and the behaviors allow consumers to implement accessibility aspects of the components in a customized way, that better fits the requirements of the consumer. | ||
|
||
Accessibility behavior is a function that takes properties of the component combined with state and maps it to: | ||
- `role`, `aria-*` attributes, `tabIndex` and other attributes related to accessibility | ||
jurokapsiar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- assignement of keyboard keys to component actions | ||
jurokapsiar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- focus zone (arrow keys navigation) definition | ||
|
||
## Component creation process | ||
1. Create accessible component prototype | ||
2. Validate the prototype (test with all supported screen reader / OS combinations) | ||
jurokapsiar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
3. Design and develop the component | ||
4. Test the component | ||
5. Formulate meaningful best practices providing information, what the consumer need to do in order to achieve optimal experience | ||
6. Extend accessibility validation schema to reflect the best practices | ||
|
||
## Using behaviors in the components | ||
Every component relevant to accessibility needs to have: | ||
- default accessibility behavior, including specification or description in it's `@accessibility` jsdoc section | ||
- optionally other available accessibility attributes, listed in `@available` jsdoc section | ||
- `accessibility` property with default value specified | ||
- `Best practices` section describing concerns that are not covered by the component itself and the user need to implement them or provide required information | ||
|
||
# Testing | ||
Every change needs to be tested for following use cases mentioned above. | ||
|
||
## Test automation | ||
It is estimated that test automation can discover around 30% of accessibility issues. | ||
Components need to be unit-tested using [axe-core](https://www.deque.com/axe/). Using other test automation tools is also being considered. | ||
|
||
## Manual testing | ||
Manual testing with all supported client/screen reader combinations is required. | ||
|
||
## Validation framework | ||
Fluent UI development build includes [Ability attributes](https://github.com/microsoft/ability-attributes) validation framework that validates the accessibility on the documentation page in real time. Any detected error is immediately reported in the bottom edge of the window. | ||
|
||
The [schema](https://github.com/microsoft/fluent-ui-react/blob/master/packages/ability-attributes/schema.json) that defines the accessibility rules is higly customizable and needs to reflect current state of the components. | ||
jurokapsiar marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.