Expose accessibility order (#50481)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Joe Vilches
2025-04-07 14:46:29 -07:00
committed by Facebook GitHub Bot
parent f75f2617ac
commit 9cd8efa897
3 changed files with 16 additions and 0 deletions
@@ -358,6 +358,13 @@ export type AccessibilityProps = $ReadOnly<{
*/
'aria-label'?: ?Stringish,
/**
* Defines the order in which descendant elements receive accessibility focus.
* The elements in the array represent nativeID values for the respective
* descendant elements.
*/
experimental_accessibilityOrder?: ?Array<string>,
/**
* Indicates to accessibility services to treat UI component like a specific role.
*/
@@ -3648,6 +3648,7 @@ export type AccessibilityProps = $ReadOnly<{
accessibilityLabel?: ?Stringish,
accessibilityHint?: ?Stringish,
\\"aria-label\\"?: ?Stringish,
experimental_accessibilityOrder?: ?Array<string>,
accessibilityRole?: ?AccessibilityRole,
role?: ?Role,
accessibilityState?: ?AccessibilityState,
@@ -823,6 +823,14 @@ folly::dynamic HostPlatformViewProps::getDiffProps(
result["accessibilityLabelledBy"] = accessibilityLabelledByValues;
}
if (accessibilityOrder != oldProps->accessibilityOrder) {
auto accessibilityChildrenIds = folly::dynamic::array();
for (const auto& accessibilityChildId : accessibilityOrder) {
accessibilityChildrenIds.push_back(accessibilityChildId);
}
result["experimental_accessibilityOrder"] = accessibilityChildrenIds;
}
if (accessibilityLiveRegion != oldProps->accessibilityLiveRegion) {
switch (accessibilityLiveRegion) {
case AccessibilityLiveRegion::Assertive: