Repository navigation
Keep View hover handling in ReactViewGroup when pointer events are on - #59046
Draft
YevheniiKotyrlo wants to merge 1 commit into
Draft
YevheniiKotyrlo wants to merge 1 commit into
YevheniiKotyrlo wants to merge 1 commit into
Conversation
…ts are dispatched With ReactFeatureFlags.dispatchPointerEvents on, ReactViewGroup.onHoverEvent returns its touch-target answer without calling View.onHoverEvent, which is where Android sends TYPE_VIEW_HOVER_ENTER and TYPE_VIEW_HOVER_EXIT. TalkBack's explore-by-touch turns a finger into hover events and focuses the view that sends them, so a React Native view under the finger stops announcing itself. ReactViewGroup now runs the View implementation for its side effects and keeps returning the touch-target answer react#46445 introduced.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
With
ReactFeatureFlags.dispatchPointerEventson,ReactViewGroup.onHoverEventreturnscanBeTouchTarget(pointerEvents)without callingsuper.onHoverEvent.View.onHoverEventis where Android sendsTYPE_VIEW_HOVER_ENTER/TYPE_VIEW_HOVER_EXIT, sets the hovered state and hands touch-exploration hover to aTouchDelegate, so with the flag on aReactViewGroupnever sends the hover events TalkBack's explore-by-touch focuses by, and never takesstate_hoveredunder a mouse or a stylus. #55418 reports the TalkBack symptom and traces it to #46445; it was closed as stale without a fix.The branch now calls
super.onHoverEvent(event)for those effects and still answers whether the view is a touch target, so hover keeps the routing #46445 gave it.Changelog:
[ANDROID] [FIXED] - Views send accessibility hover events while pointer events are dispatched
Test Plan:
Two Robolectric cases in
ReactViewGroupTest, withdispatchPointerEventson: a hover enter sendsTYPE_VIEW_HOVER_ENTER, and a hover still answers whether the view is a touch target (pointerEvents = NONEanswersfalse).Expecting ArrayList: [] to contain: [128]../gradlew :packages:react-native:ReactAndroid:testDebugUnitTest -Preact.internal.useHermesStable=true -PenableWarningsAsErrors=truepasses,ReactViewGroupTestincluded.node ./scripts/format-kotlin.js --check) is clean on both files.