docs: Update TouchableRipple.tsx to note a11y considerations #4777
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.
Motivation
Not passing an
onPress
toTouchableRipple
silently breaks the component for users of several types of accessibility technologies (screen reader, voice control, likely others), either by hiding the element completely (voice control) or announcing it as dimmed/disabled (screen readers), even if there's an activeonPress
in an interior component.Most mobile developers do not QA their work on accessibility technologies, so this likely results in many app functions being made inaccessible to accessibility technology users.
Noting this in the docs would help catch at least devs who read the docs and make them aware of how to preserve the a11y of their UIs using this component.
Stronger alternatives would be to make
onPress
required; or to add nuance to this logic, and the logic dependent on it:However, updating the docs is a low lift that will help the issue, without requiring any changes in the principles of the component.
If there's openness to either of the other solutions, I'm happy to take a crack at it, but it would require departing from the principle, which looks to be explicitly stated in the code, that a
TouchableRipple
without anonPress
is disabled.Related issue
n/a
Test plan
Read the updated docs, make sure they're clear and formatted correctly.