-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* accessibility role * more documentation * chore: restore home screen
- Loading branch information
Showing
11 changed files
with
338 additions
and
72 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains 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
This file contains 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
This file contains 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,118 @@ | ||
--- | ||
ama_severity: 2 | ||
ama_category: U | ||
ama_affected_users: Visual | ||
ama_success_criterion: 4.1.2@https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html | ||
--- | ||
|
||
# Accessibility States | ||
|
||
Accessibility states are specific attributes that can be added to a component to communicate its current status to assistive technology. | ||
|
||
## aria-busy | ||
|
||
<Serious withLabel /> | ||
|
||
<br /><br /> | ||
|
||
Indicates an element is being modified and that assistive technologies may want to wait until the changes are complete before informing the user about the update.[^1] | ||
|
||
| Type | Default | | ||
| ------- | ------- | | ||
| boolean | false | | ||
|
||
### Expectations | ||
|
||
<ScreenReader> | ||
<When title="The user triggers (double tap) a component"> | ||
<And title="The component is performing a long (or async) task"> | ||
<Then noChildren>The Screen Reader announces the component as <strong>busy</strong></Then> | ||
</And> | ||
</When> | ||
</ScreenReader> | ||
|
||
#### Example | ||
|
||
Assuming we have a button that adds the given product ID to the cart, which requires an API call: | ||
|
||
```tsx | ||
const AddToCart = ({ productID }: { productID: string }) => { | ||
const { addToCart, isAddingToCart } = useQuery(ADD_TO_CART); | ||
|
||
const onPress = async () => { | ||
const result = await addToCart(); | ||
}; | ||
|
||
return ( | ||
<Pressable | ||
accessibilityLabel="Add to cart" | ||
accessibilityRole="button" | ||
ariaBusy={isAddingToCart} | ||
onPress={isAddingToCart ? undefined : onPress} | ||
> | ||
{isAddingToCart} ? <ActivityIndicator /> : <Text>Add to cart</Text> | ||
</Pressable> | ||
); | ||
}; | ||
``` | ||
|
||
In the example, while the adding action is happening, the button: | ||
|
||
- Ignores any press action | ||
- Shows a loading spinner | ||
|
||
While this works fine for sighted users, we must add the `ariaBusy={isAddingToCart}` property for visually impaired users. | ||
|
||
### Screen Reader behaviour | ||
|
||
#### The user double taps on the example component: | ||
|
||
| Voice Over | Talkback | | ||
| ---------- | ----------------------------- | | ||
| | plays a sound as confirmation | | ||
|
||
#### The user focuses again on the component while the API is still in flight: | ||
|
||
| Voice Over | Talkback | | ||
| ---------- | ------------------------------------------------- | | ||
| | Add to cart, busy, button, double tap to activate | | ||
|
||
## aria-checked | ||
|
||
Indicates the state of a checkable element. This field can either take a boolean or the "mixed" string to represent mixed checkboxes. | ||
|
||
| Type | Default | | ||
| ---------------- | ------- | | ||
| boolean, 'mixed' | false | | ||
|
||
## aria-disabled | ||
|
||
Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. | ||
|
||
| Type | Default | | ||
| ------- | ------- | | ||
| boolean | false | | ||
|
||
## aria-expanded | ||
|
||
Indicates whether an expandable element is currently expanded or collapsed. | ||
|
||
| Type | Default | | ||
| ------- | ------- | | ||
| boolean | false | | ||
|
||
## aria-selected | ||
|
||
Indicates whether a selectable element is currently selected or not. | ||
|
||
| Type | Default | | ||
| ------- | ------- | | ||
| boolean | false | | ||
|
||
## External references | ||
|
||
- [MDN: aria-busy](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy) | ||
- [MDN: aria-checked](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked) | ||
- [MDN: aria-disabled](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled) | ||
- [MDN: aria-expanded](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) | ||
- [MDN: aria-selected](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) |
This file contains 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
This file contains 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,34 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# POUR - Accessibility Principles | ||
|
||
## Perceivable | ||
|
||
Information and user interface components must be presentable to users in ways they can perceive. | ||
|
||
The Perceivable principle includes guidelines for text alternatives, time-based media, adaptable content, and distinguishable content. | ||
|
||
## Operable | ||
|
||
User interface components and navigation must be operable. | ||
|
||
The Operable principle includes guidelines for keyboard accessibility, providing enough time, avoiding seizures and physical reactions, navigation, and input modalities. | ||
|
||
## Understandable | ||
|
||
Information and the operation of user interface must be understandable. | ||
|
||
The Understandable principle includes guidelines for readable content, predictable content, and input assistance. | ||
|
||
## Robust | ||
|
||
Content must be robust enough that it can be interpreted by a wide variety of user agents, including assistive technologies. | ||
|
||
The Robust principle includes guidelines for content that is compatible with current and future user agents. | ||
|
||
## External references | ||
|
||
- [What Does It Mean for Content to be POUR?](https://www.accessibility.com/blog/what-does-it-mean-for-content-to-be-pour) | ||
- [Web Accessibility: POUR Acronym Explained](https://equalizedigital.com/web-accessibility-p-o-u-r-acronym/) |
This file contains 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
Oops, something went wrong.