react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Disabled prop on TouchableOpacity not respected by TalkBack [Android]

Open AdamGerthel opened this issue 4 years ago • 6 comments

Description

The disabled prop on TouchableOpacity component is ignored on Android when using the built in screen reader (i.e. TalkBack). The onPress function is triggered no matter the value of disabled.

React Native version:

Run react-native info in your terminal and copy the results here.

System: OS: macOS 10.15.6 CPU: (8) x64 Intel(R) Core(TM) i7-1060NG7 CPU @ 1.20GHz Memory: 69.95 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node Yarn: 1.22.0 - /usr/local/bin/yarn npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.9.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 13.7, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 Android SDK: API Levels: 28, 29 Build Tools: 28.0.3, 29.0.2, 29.0.3 System Images: android-21 | Intel x86 Atom_64, android-21 | Google APIs Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-R | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 4.0 AI-193.6911.18.40.6626763 Xcode: 11.7/11E801a - /usr/bin/xcodebuild Languages: Java: 1.8.0_242-release - /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/javac Python: 2.7.15 - /usr/local/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.2 => 0.63.2 npmGlobalPackages: react-native: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Create a touchable element with property "disabled" set to true
  2. Add any type of onPress function to test (console.log or similar)
  3. Activate TalkBack on the device
  4. Press the button (i.e. double-tap)

Expected Results

Since the touchable element is disabled, the onPress function should not be triggered. It works as expected on iOS.

Snack, code example, screenshot, or link to a repository:

https://snack.expo.io/@insats/disabled-not-respected

AdamGerthel avatar Sep 09 '20 09:09 AdamGerthel

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

stale[bot] avatar Dec 25 '20 16:12 stale[bot]

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

This is still an issue, it's most likely just that not that many people work with accessibility so it's an unusual problem, but nonetheless important to fix.

AdamGerthel avatar Dec 25 '20 16:12 AdamGerthel

You can easily work around this by passing onPress={disabled ? undefined : action}, but nevertheless this stil is an issue.

robrechtme avatar Dec 28 '20 12:12 robrechtme

I have the same issue with Pressable component. Talkback does not respect the disabled prop.

lefterisk avatar Feb 21 '21 14:02 lefterisk

Duplicate of https://github.com/facebook/react-native/issues/30950

robrechtme avatar Mar 22 '21 15:03 robrechtme

Thank you @robrechtme for bringing this to my attention!

@AdamGerthel can you see if the recent pull request #31135 fixed this issue? If so we can close this issue.

amarlette avatar Mar 22 '21 23:03 amarlette

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jul 12 '23 05:07 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Jul 19 '23 05:07 github-actions[bot]