Skip to content

Commit 9cd8efa

Browse files
joevilchesfacebook-github-bot
authored andcommitted
Expose accessibility order (#50481)
Summary: Pull Request resolved: #50481 It's here! kinda...this only works internally right now, so no OSS usage which is explicitly gated to be off. We can't really avoid exposing the types so here we are. Changelog: [Internal] Reviewed By: jorge-cab Differential Revision: D72428425 fbshipit-source-id: 9642e5db46f9bd34ff505b0e37987da52857b6e9
1 parent f75f261 commit 9cd8efa

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Diff for: packages/react-native/Libraries/Components/View/ViewAccessibility.js

+7
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,13 @@ export type AccessibilityProps = $ReadOnly<{
358358
*/
359359
'aria-label'?: ?Stringish,
360360

361+
/**
362+
* Defines the order in which descendant elements receive accessibility focus.
363+
* The elements in the array represent nativeID values for the respective
364+
* descendant elements.
365+
*/
366+
experimental_accessibilityOrder?: ?Array<string>,
367+
361368
/**
362369
* Indicates to accessibility services to treat UI component like a specific role.
363370
*/

Diff for: packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

+1
Original file line numberDiff line numberDiff line change
@@ -3648,6 +3648,7 @@ export type AccessibilityProps = $ReadOnly<{
36483648
accessibilityLabel?: ?Stringish,
36493649
accessibilityHint?: ?Stringish,
36503650
\\"aria-label\\"?: ?Stringish,
3651+
experimental_accessibilityOrder?: ?Array<string>,
36513652
accessibilityRole?: ?AccessibilityRole,
36523653
role?: ?Role,
36533654
accessibilityState?: ?AccessibilityState,

Diff for: packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,14 @@ folly::dynamic HostPlatformViewProps::getDiffProps(
823823
result["accessibilityLabelledBy"] = accessibilityLabelledByValues;
824824
}
825825

826+
if (accessibilityOrder != oldProps->accessibilityOrder) {
827+
auto accessibilityChildrenIds = folly::dynamic::array();
828+
for (const auto& accessibilityChildId : accessibilityOrder) {
829+
accessibilityChildrenIds.push_back(accessibilityChildId);
830+
}
831+
result["experimental_accessibilityOrder"] = accessibilityChildrenIds;
832+
}
833+
826834
if (accessibilityLiveRegion != oldProps->accessibilityLiveRegion) {
827835
switch (accessibilityLiveRegion) {
828836
case AccessibilityLiveRegion::Assertive:

0 commit comments

Comments
 (0)