refactor: migrate accessibility props to aria props#5005
Open
MrMuzyk wants to merge 6 commits into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
React Native added aria-* props as web-compatible aliases for the legacy accessibility* props. This PR migrates the library's internal usage across all components to the modern API, so components work correctly with React Native Web and align with the direction RN is taking the accessibility API.
Changes
Mapping applied uniformly:
accessibilityLabel→aria-labelaccessibilityRole→roleaccessibilityState={{ disabled }}→aria-disabledaccessibilityState={{ selected }}→aria-selectedaccessibilityState={{ checked }}→aria-checkedaccessibilityState={{ expanded }}→aria-expandedTextInputadditionally replacesaccessibilityState: { disabled, invalid }witharia-disabledandaria-invalid. Becausearia-invalidis not yet in RN'sAccessibilityPropstype (RN 0.85.3),GetAccessibilityDataReturn.inputuses an intersection typeAccessibilityProps & { 'aria-invalid'?: boolean }.BREAKING CHANGE:
aria-*props take precedence overaccessibility*props in React Native when both are set on the same element. Consumers who passaccessibilityLabel,accessibilityRole, oraccessibilityStateto Paper components to override defaults will be silently ignored after this bump.Related issue
N/A
Test plan
yarn typescriptcleanyarn lintcleanyarn jest— 9 test files updated to query/assert onaria-*props instead ofaccessibilityState/accessibilityLabel; 28 snapshot files regenerated to reflect the prop rename in the render tree. Full suite passes.