Skip to content

There is no way to manage focus for external keyboard from one element to another #39052

@nedgip

Description

@nedgip

Description

Sometimes we need to set external keyboard focus from one place to another, for instance from one Pressable to another Pressable, or from a Pressable to a View.

For Screen Reader users we can use AccessibilityInfo.setAccessibilityFocus(tag) to manage focus, but this technique does not work for the external keyboard when a screen reader is not switched on.

The standard React method of ref.current.focus() also does not work for external keyboard users on mobile (only web).

React Native Version

0.71.3

Output of npx react-native info

I don't have access to this.

Steps to reproduce

On Android or iOS physical device:

  1. Connect a hardware keyboard to the device using bluetooth.
  2. Open https://snack.expo.dev/@nedgip/external-keyboard-focus-example-1 in Expo Go
  3. Navigate to the Send focus button using arrow keys
  4. Press Space

Expected

Focus should move to the Receive focus button

Actual

Focus remains on the Send focus button

Snack, screenshot, or link to a repository

  1. https://snack.expo.dev/@nedgip/external-keyboard-focus-example-1
  2. https://snack.expo.dev/@nedgip/external-keyboard-focus-example-2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions