Skip to content

Commit 3550da1

Browse files
fix: scope hover check to touch exploration enabled
1 parent 140f7be commit 3550da1

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,12 @@ public open class ReactViewGroup public constructor(context: Context?) :
305305
return false
306306
}
307307

308-
// For accessibility (TalkBack), check if hover is within any child's hitSlop area
309-
if (ev.isFromSource(android.view.InputDevice.SOURCE_CLASS_POINTER) &&
308+
// For accessibility services (TalkBack), check if hover is within any child's hitSlop area.
309+
// Only apply this logic when accessibility services are enabled to avoid interfering with
310+
// other input methods (VR, mouse, stylus, etc.)
311+
val accessibilityManager = context.getSystemService(Context.ACCESSIBILITY_SERVICE) as? AccessibilityManager
312+
if (accessibilityManager?.isTouchExplorationEnabled == true &&
313+
ev.isFromSource(android.view.InputDevice.SOURCE_CLASS_POINTER) &&
310314
(ev.action == MotionEvent.ACTION_HOVER_ENTER || ev.action == MotionEvent.ACTION_HOVER_MOVE)) {
311315
val x = ev.x
312316
val y = ev.y

0 commit comments

Comments
 (0)