react-native: accessibilityLabel does not work for Text component on iOS
Description
Continuing the discussion from https://github.com/facebook/react-native/issues/13648#issuecomment-303046218, for <Text>
component on iOS, the actual label of the text always overrides the testID
and accessibilityLabel
Reproduction Steps and Sample Code
- Create a new RN app using
react-native init
- Edit index.ios.js
- Find the “Welcome to React Native” text and change it to
<Text testID={'welcome'} accessibilityLabel={'welcome'}>Welcome to React Native!</Text>
- Run this app on an iOS simulator and inspect it with Accessibility Inspector
Expected: The Accessibility Inspector should say the Label is welcome
.
Actual: The Accessibility Inspector says the Label is Welcome to React Native!
.
Note: - with the same set of properties on Android the contentDescription
is welcome
which is what I expect.
Additional Information
- React Native version: 0.44.0
- Platform: iOS 10.1 Simulator
- Development Operating System: Mac OSX 10.11.6
- Dev tools: XCode 8.1, Accessibility Inspector 5.0
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 11
- Comments: 16 (7 by maintainers)
@curioustechizen @vasyares The fix has been made and is in a PR. Setting the
accessibilityLabel
of a<Text>
component will now return the correct value as expected.This has been fixed as of https://github.com/facebook/react-native/commit/915a020fcaaefc8c8c5a2016e79e9d6127c6e008