Skip to content

Keep View hover handling in ReactViewGroup when pointer events are on - #59046

Draft
YevheniiKotyrlo wants to merge 1 commit into
react:mainfrom
YevheniiKotyrlo:fix/android-pointer-events-hover-accessibility
Draft

YevheniiKotyrlo wants to merge 1 commit into
react:mainfrom
YevheniiKotyrlo:fix/android-pointer-events-hover-accessibility

Conversation

@YevheniiKotyrlo

Copy link
Copy Markdown
Contributor

Summary:

With ReactFeatureFlags.dispatchPointerEvents on, ReactViewGroup.onHoverEvent returns canBeTouchTarget(pointerEvents) without calling super.onHoverEvent. View.onHoverEvent is where Android sends TYPE_VIEW_HOVER_ENTER / TYPE_VIEW_HOVER_EXIT, sets the hovered state and hands touch-exploration hover to a TouchDelegate, so with the flag on a ReactViewGroup never sends the hover events TalkBack's explore-by-touch focuses by, and never takes state_hovered under 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, with dispatchPointerEvents on: a hover enter sends TYPE_VIEW_HOVER_ENTER, and a hover still answers whether the view is a touch target (pointerEvents = NONE answers false).

  • Without the fix the first case fails: Expecting ArrayList: [] to contain: [128].
  • With it, ./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest -Preact.internal.useHermesStable=true -PenableWarningsAsErrors=true passes, ReactViewGroupTest included.
  • ktfmt (node ./scripts/format-kotlin.js --check) is clean on both files.

…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.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 13, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant