Skip to content

Send accessibility hover events from ReactViewGroup when pointer events are enabled (#59992) - #59992

Open
cortinico wants to merge 1 commit into
react:mainfrom
cortinico:export-D131164392
Open

cortinico wants to merge 1 commit into
react:mainfrom
cortinico:export-D131164392

Conversation

@cortinico

@cortinico cortinico commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

When ReactFeatureFlags.dispatchPointerEvents is enabled, ReactViewGroup.onHoverEvent returned canBeTouchTarget(pointerEvents) without calling View.onHoverEvent, so React Native views never sent TYPE_VIEW_HOVER_ENTER/EXIT accessibility events. Hover-driven accessibility services (for example hover text-to-speech) were silent over the body of a pressable view, while its plain text and image children, which don't override onHoverEvent, still spoke.

Just calling super.onHoverEvent is not enough: a pressable often contains a full-size pointerEvents="none" overlay child, and View.onHoverEvent skips accessibility hover while any child is hovered. This change makes ReactViewGroup send hover enter/exit itself, from its nearest important-for-accessibility ancestor, when it can be a touch target. It stays silent while a child that can take the hover is under the pointer. pointerEvents="none" children are ignored and box-none children are checked one level deeper. The view remembers which view received HOVER_ENTER and sends the matching HOVER_EXIT to that same view, so enter/exit stay paired even if no ancestor was important for accessibility at enter time or the important ancestor changes mid-hover. A pending HOVER_EXIT is also sent when the view is recycled or detached from the window mid-hover. Behavior with pointer events disabled is unchanged.

Note for reviewers: a plain hovered container now emits hover enter/exit the way stock Android does with the flag off.

Changelog: [Android][Fixed] - Send accessibility hover events from ReactViewGroup when pointer events dispatch is enabled

Differential Revision: D131164392

@meta-codesync

meta-codesync Bot commented Nov 13, 2026

Copy link
Copy Markdown

@cortinico has exported this pull request. If you are a Meta employee, you can view the originating Diff in D131164392.

@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 13, 2026
@meta-codesync meta-codesync Bot changed the title Send accessibility hover events from ReactViewGroup when pointer events are enabled Send accessibility hover events from ReactViewGroup when pointer events are enabled (#59992) Nov 13, 2026
cortinico added a commit to cortinico/react-native that referenced this pull request Nov 13, 2026
…ts are enabled (react#59992)

Summary:

When `ReactFeatureFlags.dispatchPointerEvents` is enabled, `ReactViewGroup.onHoverEvent` returned `canBeTouchTarget(pointerEvents)` without calling `View.onHoverEvent`, so React Native views never sent `TYPE_VIEW_HOVER_ENTER`/`EXIT` accessibility events. Hover-driven accessibility services (for example hover text-to-speech) were silent over the body of a pressable view, while its plain text and image children, which don't override `onHoverEvent`, still spoke.

Just calling `super.onHoverEvent` is not enough: a pressable often contains a full-size `pointerEvents="none"` overlay child, and `View.onHoverEvent` skips accessibility hover while any child is hovered. This change makes `ReactViewGroup` send hover enter/exit itself, from its nearest important-for-accessibility ancestor, when it can be a touch target. It stays silent while a child that can take the hover is under the pointer. `pointerEvents="none"` children are ignored and `box-none` children are checked one level deeper. The view remembers which view received HOVER_ENTER and sends the matching HOVER_EXIT to that same view, so enter/exit stay paired even if no ancestor was important for accessibility at enter time or the important ancestor changes mid-hover. A pending HOVER_EXIT is also sent when the view is recycled or detached from the window mid-hover. Behavior with pointer events disabled is unchanged.

Note for reviewers: a plain hovered container now emits hover enter/exit the way stock Android does with the flag off.

Changelog: [Android][Fixed] - Send accessibility hover events from `ReactViewGroup` when pointer events dispatch is enabled

Differential Revision: D131164392
…ts are enabled (react#59992)

Summary:

When `ReactFeatureFlags.dispatchPointerEvents` is enabled, `ReactViewGroup.onHoverEvent` returned `canBeTouchTarget(pointerEvents)` without calling `View.onHoverEvent`, so React Native views never sent `TYPE_VIEW_HOVER_ENTER`/`EXIT` accessibility events. Hover-driven accessibility services (for example hover text-to-speech) were silent over the body of a pressable view, while its plain text and image children, which don't override `onHoverEvent`, still spoke.

Just calling `super.onHoverEvent` is not enough: a pressable often contains a full-size `pointerEvents="none"` overlay child, and `View.onHoverEvent` skips accessibility hover while any child is hovered. This change makes `ReactViewGroup` send hover enter/exit itself, from its nearest important-for-accessibility ancestor, when it can be a touch target. It stays silent while a child that can take the hover is under the pointer. `pointerEvents="none"` children are ignored and `box-none` children are checked one level deeper. The view remembers which view received HOVER_ENTER and sends the matching HOVER_EXIT to that same view, so enter/exit stay paired even if no ancestor was important for accessibility at enter time or the important ancestor changes mid-hover. A pending HOVER_EXIT is also sent when the view is recycled or detached from the window mid-hover. Behavior with pointer events disabled is unchanged.

Note for reviewers: a plain hovered container now emits hover enter/exit the way stock Android does with the flag off.

Changelog: [Android][Fixed] - Send accessibility hover events from `ReactViewGroup` when pointer events dispatch is enabled

Differential Revision: D131164392
@github-actions

Copy link
Copy Markdown

Visual regression

No visual differences at a9b2ac472a36.

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. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant