Skip to content

Commit 499084e

Browse files
author
Marc Mulcahy
committed
Proposal to add accessibility actions.
1 parent 6462a12 commit 499084e

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

proposals/0000-a11y-actions.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---title: Accessibility Actions Support
2+
author:
3+
- Marc Mulcahy
4+
date: 2018-10-31
5+
---
6+
7+
# RFC0000: Accessibility Actions Support
8+
9+
## Summary
10+
11+
Custom components often require interactions beyond simple touches. Programatic access to these interactions must be provided to allow disabled users to perform them.
12+
13+
## Basic example
14+
15+
Consider the simple example of a custom slider. The newly expanded accessibilityRole property allows us to indicate that the component is a slider in a cross-platform way. However, the blind or motor impaired user can't adjust the slider, since a gesture other than a single tap is required to do so.
16+
17+
## Motivation
18+
19+
The example above is one use case, but there are several common patterns and use cases which require custom action support. Here are a few examples:
20+
21+
* Adjustable controls (such as sliders)
22+
* Scrollable containers where the scrolling is not handled natively
23+
* Extra swipe actions in a list (swipe right to delete an email message for example)
24+
25+
## Detailed design
26+
27+
This proposal adds an additional accessibility-related property called accessibilityActions to View. The value of this property is a list of accessibility action objects. Each action contains the following properties:
28+
29+
* name: a string name for the action. Note that a pre-defined set of standard actions is supported, but components can also define their own custom actions.
30+
* description: a localized description of the action which can be presented to the user to describe what will happen when the action is performed.
31+
* function: the function to call when the assistive technology requests this action to be performed. This function should return true if the action is performed, and false if not.
32+
33+
Standard action names include:
34+
35+
* activate: activate the item (typically accomplished by double tapping the item when using a screen reader)
36+
* longpress: Long presses anywhere inside the component
37+
* scrollforward: Scrolls the component forward one screen full
38+
* scrollbackward: Scrolls the component backward one screen full
39+
* dismiss: Dismisses the component
40+
* magictap: on iOS, user double taps with two fingers while accessibility focus is on the component. Not available on Android.
41+
* adjustup: Adjusts component up
42+
* adjustdown: adjust component down
43+
* expand: Expands the component
44+
* collapse: Collapses the component
45+
* copy: copies content in the component to the clipboard
46+
* cut: cuts content in the component to the clipboard
47+
* paste: pastes clipboard contents into this component
48+
* setvalue: sets the value of this component (typically used to adjust sliders, etc.)
49+
50+
### Implementation Notes
51+
52+
#### Android/Fire OS
53+
54+
A custom AccessibilityDelegate will handle custom actions which are added to React Native components. This concept maps fairly directly to Android's notion of AccessibilityActions.
55+
56+
#### iOS
57+
58+
React Native actions will be implemented on iOS via the UIAccessibilityAction informal protocol. Standard actions will be used to support React Native standard actions where appropriate. iOS custom actions will be used to support React Native custom accessibility actions.
59+
60+
## Drawbacks
61+
62+
* Difficult for new developers to know what actions they should support.
63+
* Localization of action descriptions seems problematic and hard to maintain.
64+
* Any performance concerns making the action functions synchronous?
65+
66+
## Alternatives
67+
68+
For native components, the platform often provides the necessary actions or other support to allow assistive technologies to manipulate the components. This is only required for custom components built entirely in JavaScript. But for such components, I don't know of another solution.
69+
70+
## Adoption strategy
71+
72+
This is not a breaking change. Components can migrate to the new API as needed.
73+
74+
## How we teach this
75+
76+
The simple rule of thumb is that if your component can be manipulated in ways other than a simple touch, it needs custom action support. The tricky bit to teach will be exactly what actions should you support, especially for scrolling containers.
77+
78+
## Unresolved questions
79+
80+
* What is the most efficient way to localize the description strings? Should they be IDs rather than actual strings?
81+
* How will we add custom actions to native components?
82+
* What additional standard actions should be supported?
83+
* When an action supports arguments, how should we communicate the meaning of those arguments to assistive technologies? Do we rely on the assistive technologies knowing about particular actions and their arguments out of band?
84+
* Should we namespace actions to avoid collisions? For example, if you're defining your own copy action, should the name be "com.example.copy"?

0 commit comments

Comments
 (0)