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

Can't focus into text fields, Android + external keyboard

Open brucelawson opened this issue 2 years ago • 12 comments

In the first Expo example on https://reactnative.dev/docs/textinput - with an external physical keyboard on Android, we don't seem to be able to move the focus into/ between these input fields. It's fine if you tap the screen, and it's fine if Talkback is on and we alt+arrow between the fields. But with Talkback off, and just using the keyboard, we can't get focus into the fields.

Expected Results

That the fields can be focussed by the keyboard

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

https://snack.expo.io/PT9eBWga1 (saved from the first example on https://reactnative.dev/docs/textinput)

brucelawson avatar Jul 06 '21 16:07 brucelawson

Same issue can be seen on Facebook Marketplace. Our workaround was to wrap the textinput in a Pressable and set focus manually.

brucelawson avatar Jul 07 '21 09:07 brucelawson

@brucelawson we are also facing this issue. Could you share the code snippet? Also, are you able to get it working on ios?

kriti18singh avatar Jul 08 '21 12:07 kriti18singh

@kriti18singh I will once we've tested and proved it. (I don't want to let something loose without knowing its side-effects)

brucelawson avatar Jul 08 '21 17:07 brucelawson

Commit 8 days ago appears related https://github.com/facebook/react-native/commit/d4a498aba2d2843e7a741a31b0c91c6a79a7386c

brucelawson avatar Jul 14 '21 12:07 brucelawson

Hey @brucelawson thanks for submitting this issue, we'll take a closer look soon and report back!

alextait1 avatar Jun 22 '22 16:06 alextait1

@brucelawson: We've taken a look as a team and will pull this into our prioritized issues, will report back when it's in progress. Thanks again for submitting.

alextait1 avatar Jul 27 '22 17:07 alextait1

Hi @alextait1, I would love to know if there are any updates on this matter. In the mean time we're looking at workarounds as described in #30464.

pandu-supriyono avatar Apr 12 '23 14:04 pandu-supriyono

Hey @pandu-supriyono I'm no longer working on this project, maybe @blavalla can provide an update

alextait1 avatar Apr 12 '23 14:04 alextait1

Hello here, The easiest way it's wrapping TextField in something, I wrote specific lib to support keyboard focus for a11y: https://www.npmjs.com/package/react-native-a11y

You can wrap TextInput into KeyboardFocusView and focus TextInput on onFocusChanged event.

    <KeyboardFocusView onFocusChanged={(e) => {
            if(e.nativeEvent.isFocused) {
              ref.focus()
            }
          }}>
            <TextInput
              ref={inputRef}
            />
          </KeyboardFocusView>

I can imagine more elegant solution on old arch, but new arch is hell challenging

ArturKalach avatar Apr 22 '23 18:04 ArturKalach

There are a tricky fix from the native side: https://github.com/ArturKalach/react-native-a11y/blob/master/docs/AndroidInput.md

android-example

ArturKalach avatar May 02 '23 19:05 ArturKalach

Are there any plans to fix the keyboard accessibility of the <TextInput>?

The workaround https://github.com/facebook/react-native/issues/30464 to wrap the <TextInput> in a <Pressable> doesn't work with the Tab key and doesn't support keyboard users who also use a screen reader.

The React Native <TextInput> should be accessible using a physical keyboard out-of-the-box without implementing workarounds as it is a critical element for many apps.

nedgip avatar Jul 17 '23 09:07 nedgip

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 Feb 24 '24 05:02 github-actions[bot]

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

github-actions[bot] avatar Mar 02 '24 05:03 github-actions[bot]

Is there any proper solution to make it work as expected ? I am still facing this issue.

sharad-incapsulate avatar Mar 20 '24 12:03 sharad-incapsulate

Same here

chimiWangchukWangdi avatar Apr 04 '24 13:04 chimiWangchukWangdi

Great to see the priority given to this accessibility bug! It's 2 years, 8 months and 29 days since I posted it.

brucelawson avatar Apr 05 '24 09:04 brucelawson