React-native: [Android] Focus is removed from TextInput when Talkback is enabled

Created on 4 Feb 2017  路  29Comments  路  Source: facebook/react-native

Description

Our project is a hybrid of React Native modules and native UI. We are adding accessibility to our App and are hitting a weird issue with Talkback in TextInput:

If there is any clickable element before a TextInput in the view hierarchy, double tapping to add focus to the TextInput using Talkback sends the focus to the clickable element before it.

Reproduction

I have been able to reproduce the bug in a sample app: https://github.com/oargaruna/TextInputTalkback

  1. Deploy the App on an Android device
  2. Enable Talkback (from Settings -> Accessibility) and open the Sample App
  3. Tap once on the TextInput to give it Talkback focus
  4. Tap twice to try to get the keyboard to come up

We expect the keyboard to show up with focus on the TextInput, but the focus jumps to the TouchableOpacity element defined before it.

If the TouchableOpacity element is removed, this behaviour is not reproducible.

Additional Information

  • React Native version: 0.41.1
  • Platform: Android
Accessibility Bug TextInput Android Ran Commands Stale

Most helpful comment

I found a possible solution for this issue https://github.com/facebook/react-native/issues/24519

All 29 comments

Same issue for me. Any solution?

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

This is still happening to me on RN 0.49.3. Any workarounds?

Reopening this as it appears to be affecting us as well.

Looks like this might be a dupe of https://github.com/facebook/react-native/issues/17042 ?

The issue is caused by this line of code: https://github.com/facebook/react-native/blob/c9ff0bc212b680232f7379fba7b9332927075c3c/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java#L202
It's been there forever. I guess it means the focus is always controlled by JS code. But when TalkBack is enabled the focus needs to be set directly.

Found some comments in code:

  // This component is controlled, so we want it to get focused only when JS ask it to do so.
  // Whenever android requests focus (which it does for random reasons), it will be ignored.

I wonder if this is still an issue in recent Android versions.

The issue is not reproducible in 0.51.

@oargaruna this only happens on Android 6.

It is not working on Android 8.0 on latest version of react native as well.

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 "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

still an issue in RN v0.54 and I'm currently testing on an Android 8.1 device. definitely not device specific when looking at the code linked by @haitaoli

It is still not working in Android device with 8.0 and above in RN v0.55.3.

It's still happen in Android 8.0 - RN 0.55.4

I don't think this will ever be fixed in official releases. Fork RN and apply this PR: https://github.com/airbnb/react-native/pull/47.

This is still affecting Android 8.0 - RN 0.57.1

Do we have any context for the hack? We'd prefer not to maintain a fork, especially since that was explicitly referenced in the AirBnbB posts : P

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 "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

still an issue, bot

Hello, I'm currently using Android 8.1.0 with RN 0.51.0 and RN 0.58.3 (two apps) and both have the same problem when talkback is enabled, the keyboard does not appear when autofocus is in the textinput.
Does anyone still have the same problem yet?
Another thing I noticed is that this is happening intermittently, that is, sometimes it works, sometimes it does not work.
Thanks.

I have the same problem here. I'm using RN 0.59.3

Double tap and hold to long press on TextInput keyboard will come up, it's default behaviour. Works for me

@dishantwalia that is not default behaviour. everything should be accessible by double tapping.

To explore by touch, slowly drag one finger around the screen. TalkBack announces the icons, buttons and other items as you drag your finger over them. When the focus reaches an item that you'd like to select, double tap anywhere on the screen to select the focused item.
https://support.google.com/accessibility/android/answer/6006598?hl=en-GB

you should make sure that whatever you're testing this against is actually an input field and not a wrapper. for instance, if you use the floating label input field type provided by Native Base, you can access the input field by double tapping on the wrapper

I found a possible solution for this issue https://github.com/facebook/react-native/issues/24519

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.

still an issue

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.

still not fixed

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.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings