Repository navigation
Deliver hover to disabled ScrollView content and box-only views on Android - #60132
Open
jkasprzyk17 wants to merge 1 commit into
Open
jkasprzyk17 wants to merge 1 commit into
jkasprzyk17 wants to merge 1 commit into
Conversation
…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
Visual regressionNo visual differences at ios: no capture |
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:
On Android, a
ScrollViewwithscrollEnabled={false}returnedfalsefromdispatchGenericMotionEventfor 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 noTYPE_VIEW_HOVER_ENTEReither (#59966).ReactScrollView,ReactHorizontalScrollViewandReactNestedScrollViewnow ignore onlyACTION_SCROLLwhile scrolling is disabled, so the wheel is still ignored and hover reaches the content.#59966 also covers a
ViewwithpointerEvents="box-only".ReactViewGroup.dispatchGenericMotionEventreturnedfalsewhenever its children can't be touch targets, which dropped the view's own hover as well, although abox-onlyview is a touch target itself. It now lets hover through for a view that is a touch target, and the newonInterceptHoverEventkeeps that hover on the view, so its children still get none. Anoneview and its children still get no hover, and other generic motion events (such as the wheel) still don't reach the children of abox-onlyview.A
ScrollViewwithpointerEvents="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 withpointerEvents="box-only", so TalkBack explore by touch and stylus hover reach themTest Plan:
Unit tests (Robolectric).
ReactScrollViewDisabledHoverTestchecks for each of the three ScrollView classes that, withscrollEnabled = false, a stylus hover reaches a child and a wheel scroll is still ignored. NewReactViewGroupTestcases check that abox-onlyview gets hover and its child doesn't, that anoneview and its child get none, and that abox-onlyview still keeps a wheel event from its child.All 58 tests pass. With the
src/mainchanges reverted, 4 of the new tests fail: the three ScrollView hover tests and thebox-onlyhover test.yarn format-check-kotlinpasses.RNTester with TalkBack (Android 15 emulator, API 35). The Playground renders the reproducer from #60107 (three
Buttons in aScrollViewwithscrollEnabled={false}) and aViewwithpointerEvents="box-only"andaccessiblebelow it. With TalkBack on, I touched each Button, the label above thebox-onlyView, and thebox-onlyView, the same sequence before and after the fix.box-onlylabel when thebox-onlyView is touched.box-onlyView. 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):
I did not test stylus hover on a physical device. It goes through the same
dispatchGenericMotionEventpath as TalkBack's hover events, and the unit tests above dispatch a stylus hover.