Skip to content

Deliver hover to disabled ScrollView content and box-only views on Android - #60132

Open
jkasprzyk17 wants to merge 1 commit into
react:mainfrom
jkasprzyk17:fix/android-disabled-scrollview-hover
Open

jkasprzyk17 wants to merge 1 commit into
react:mainfrom
jkasprzyk17:fix/android-disabled-scrollview-hover

Conversation

@jkasprzyk17

@jkasprzyk17 jkasprzyk17 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

On Android, a ScrollView with scrollEnabled={false} returned false from dispatchGenericMotionEvent for every event, not just the mouse wheel. Hover events take that path too, and TalkBack's explore by touch is built on them, so with TalkBack on, nothing inside the ScrollView could be focused or read aloud (#60108). A stylus or mouse hovering over the content sent no TYPE_VIEW_HOVER_ENTER either (#59966). ReactScrollView, ReactHorizontalScrollView and ReactNestedScrollView now ignore only ACTION_SCROLL while scrolling is disabled, so the wheel is still ignored and hover reaches the content.

#59966 also covers a View with pointerEvents="box-only". ReactViewGroup.dispatchGenericMotionEvent returned false whenever its children can't be touch targets, which dropped the view's own hover as well, although a box-only view is a touch target itself. It now lets hover through for a view that is a touch target, and the new onInterceptHoverEvent keeps that hover on the view, so its children still get none. A none view and its children still get no hover, and other generic motion events (such as the wheel) still don't reach the children of a box-only view.

A ScrollView with pointerEvents="box-only" is unchanged.

Closes #60108
Closes #59966

Changelog:

[ANDROID] [FIXED] - Deliver hover events to the content of a ScrollView with scrollEnabled={false} and to a View with pointerEvents="box-only", so TalkBack explore by touch and stylus hover reach them

Test Plan:

Unit tests (Robolectric). ReactScrollViewDisabledHoverTest checks for each of the three ScrollView classes that, with scrollEnabled = false, a stylus hover reaches a child and a wheel scroll is still ignored. New ReactViewGroupTest cases check that a box-only view gets hover and its child doesn't, that a none view and its child get none, and that a box-only view still keeps a wheel event from its child.

./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest \
  --tests 'com.facebook.react.views.scroll.*' --tests 'com.facebook.react.views.view.*' \
  -PreactNativeArchitectures=arm64-v8a

All 58 tests pass. With the src/main changes reverted, 4 of the new tests fail: the three ScrollView hover tests and the box-only hover test. yarn format-check-kotlin passes.

RNTester with TalkBack (Android 15 emulator, API 35). The Playground renders the reproducer from #60107 (three Buttons in a ScrollView with scrollEnabled={false}) and a View with pointerEvents="box-only" and accessible below it. With TalkBack on, I touched each Button, the label above the box-only View, and the box-only View, the same sequence before and after the fix.

  • Before: TalkBack focus stays on the label above the ScrollView for every Button, and on the box-only label when the box-only View is touched.
  • After: focus moves to each Button and to the box-only View. The labels behave the same in both builds.

Before:

talkback-before.mp4

After:

talkback-after.mp4

One frame after each touch, before (top) and after (bottom):

TalkBack focus after each touch, before and after the fix

I did not test stylus hover on a physical device. It goes through the same dispatchGenericMotionEvent path as TalkBack's hover events, and the unit tests above dispatch a stylus hover.

…droid

A ScrollView with scrollEnabled={false} returned false from
dispatchGenericMotionEvent for every event, so hover never reached its
content. TalkBack's touch exploration and stylus hover both arrive as
hover events, so nothing inside could be focused or hovered. Only the
mouse wheel is now ignored while scrolling is disabled.

A View with pointerEvents="box-only" dropped its own hover the same way.
It now receives hover itself through onInterceptHoverEvent, while its
children still get none.

Closes react#60108
Closes react#59966
@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 Nov 18, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 18, 2026
@github-actions

Copy link
Copy Markdown

Visual regression

No visual differences at 40cb9adf7f72.

ios: no capture

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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

1 participant