-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested text not focusable by hardware keyboards #35194
Comments
Thanks for fixing the issue with talkback @fabriziobertoglio1987! |
@ayush547 I implemented similar functionality on Android with PR #33215
When using hardware keyboard navigation, you don't tap or use the touch screen, but navigate using tab or other keys.
More info on ReactTextView onFocusChanged
The onFocusChanged callback is not triggered with ReactTextView View.AccessibilityDelegate#onFocusChanged
/**
* Called by the view system when the focus state of this view changes.
* When the focus change event is caused by directional navigation, direction
* and previouslyFocusedRect provide insight into where the focus is coming from.
* When overriding, be sure to call up through to the super class so that
* the standard focus handling will occur.
*
* @param gainFocus True if the View has focus; false otherwise.
* @param direction The direction focus has moved when requestFocus()
* is called to give this view focus. Values are
* {@link #FOCUS_UP}, {@link #FOCUS_DOWN}, {@link #FOCUS_LEFT},
* {@link #FOCUS_RIGHT}, {@link #FOCUS_FORWARD}, or {@link #FOCUS_BACKWARD}.
* It may not always apply, in which case use the default.
* @param previouslyFocusedRect The rectangle, in this view's coordinate
* system, of the previously focused view. If applicable, this will be
* passed in as finer grained information about where the focus is coming
* from (in addition to direction). Will be <code>null</code> otherwise.
*/
@CallSuper
protected void onFocusChanged(boolean gainFocus, @FocusDirection int direction,
@Nullable Rect previouslyFocusedRect) {
} The ReactRootView delegates the touch events to JavaScript
react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSPointerDispatcher.java Line 74 in a53512f
react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.java Line 65 in a53512f
react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java Line 638 in a53512f
I'll be happy to help you build this functionality! |
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. |
This issue was closed because it has been stalled for 7 days with no activity. |
Description
Nested text components are not focusable by hardware keyboards. This is blocking react native applications from being able to use hardware keyboards when trying to render things like rich text with urls. If the focusable prop was exposed on text this would resolve this issue.
Version
0.70.4
Output of
npx react-native info
System:
OS: macOS 12.6
CPU: (10) arm64 Apple M1 Pro
Memory: 187.17 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.10.0 - ~/.nvm/versions/node/v16.10.0/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 7.24.0 - ~/.nvm/versions/node/v16.10.0/bin/npm
Watchman: 2022.10.03.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: Not Found
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
Android SDK:
Android NDK: 21.4.7075529
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9014738
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
Languages:
Java: 11.0.16.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: 0.70.4 => 0.70.4
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
1: Create nested text such as
2: Plug in a physical keyboard either via usb or bluetooth to phone.
3: Notice pressing tab on keyboard does not focus nested text.
Snack, code example, screenshot, or link to a repository
See example in steps to reproduce above.
The text was updated successfully, but these errors were encountered: