accessibilityState "disabled" can NOT be changed after being set to its initial value
Description
If accessibilityState prop is set to "disabled" it can not be changed by setting accessibilityState to empty object/null or to false, e.g. { disabled: false }.
React Native version:
System:
OS: macOS 10.15.4
CPU: (4) x64 Intel(R) Core(TM) i5-6360U CPU @ 2.00GHz
Memory: 594.19 MB / 8.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.4.0 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5977832
Xcode: 11.4/11E146 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
npmGlobalPackages:
react-native-cli: 2.0.1
Snack, code example, screenshot, or link to a repository:
Whenever this.state.disabled changes its value from false to true and vise versa the acessibilityState still keeps its initial value and does not change accordingly.
<TouchableHighlight
accessible
accessibilityRole={'button'}
accessibilityLabel={'Tap me'}
accessibilityState={{ disabled: this.state.disabled }}
activeOpacity={0.6}
disabled={this.state.disabled}
onPress={this.onPress}
>
<Text>{'Tap Me'}</Text>
</TouchableHighlight>
Miscellaneous
Additionally, it seems like changes introduced in Accessibility API in RN 0.61 (deprecation of accessibilityTraits and accessibilityComponentType, accessibilityStates -> accessibilityState) have made https://github.com/facebook/react-native/issues/21122 reproducible again.
Providing key={new Date()} to a component helps to flip its accessibilityState "disabled" value.
| :warning: | Missing Environment Information |
|---|---|
| :information_source: | Your issue may be missing information about your development environment. You can obtain the missing information by running react-native info in a console. |
@hramos Could you have a look, please?
| :warning: | Using Old Version |
|---|---|
| :information_source: | It looks like you are using an older version of React Native. Please upgrade to the latest version, and verify if the issue persists. If it does not, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the current release. |
Hello @palexs, couple things. Could you verify this occurs on the latest version and provide that repro?
Just a quick note, @palexs, please avoid pinging me on individual issues especially if they were just opened. We have a issue triage process in place and folks will look at each issue in order. Thanks!
This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.
This issue was closed because the author hasn't provided the requested feedback after 7 days.