Accessibility: Adding pass-through for accessibility props. #21
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.
Swiping presents accessibility challenges. One of these challenges is that screen reader users may not be aware that content is swipeable, as the visual indication (Dots, in this case), is invisible to them.
This PR adds the React Native
accessible
andaccessibilityLabel
props for pass-through to the<View>
container within the<Dots>
element. This allows devs to make the dots accessible by screen reader, and to add an accessible label indicating that there is swipeable content on the page.Note that putting these properites on the pager view itself generally doesn't work, for the following reasons:
accessible={true}
as a single element, and not read or allow a screen reader to access any content inside. So placing anaccessible
prop andaccessibilityLabel
on the pager view itself results in loss of access to the content within the pager for users of assistive technology.Adding an accessible label to the
<Dots>
element is a superior solution. And while it can already be done by adding a wrapper<View>
around the<Dots>
package, that results in an unnecessary<View>
in the page hierarchy. This PR allows adding accessibility props without adding an additional<View>
.