Skip to content

Commit a82b5ac

Browse files
jorge-cabfacebook-github-bot
authored andcommitted
Fix jumping talkback triggering scroll when reaching a view with accessibilityOrder (#52231)
Summary: Pull Request resolved: #52231 Not calling `super.onInitializeAccessibilityNodeInfo` on the host view with accessibilityOrder prevents setting proper dimensions for the node that backs the view which leads TalkBack to trigger scrolling when under a ScrollVIew. We still need the host's node to not be accessible so we still set it to not be focusable and not have a content description since this should be handled by the virtual views Changelog: [Internal] Reviewed By: joevilches Differential Revision: D77180494 fbshipit-source-id: fe8794cf421cdc9548cf3e18a62d4bb3e8c26b09
1 parent 8cc2874 commit a82b5ac

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,13 @@ private void populateAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompa
261261

262262
@Override
263263
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) {
264+
super.onInitializeAccessibilityNodeInfo(host, info);
264265
// If we set an accessibility order then all the focusing logic should go through our custom
265266
// virtual view tree hierarchy and ignore the default path
266267
ReadableArray axOrderIds = (ReadableArray) mView.getTag(R.id.accessibility_order);
267268
if (axOrderIds != null && axOrderIds.size() != 0) {
269+
info.setContentDescription("");
270+
info.setFocusable(false);
268271

269272
AccessibilityManager am =
270273
(AccessibilityManager) host.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
@@ -299,7 +302,6 @@ public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCo
299302
return;
300303
}
301304

302-
super.onInitializeAccessibilityNodeInfo(host, info);
303305
populateAccessibilityNodeInfo(host, info);
304306
}
305307

0 commit comments

Comments
 (0)