Skip to content

Commit 96e678b

Browse files
joevilchesfacebook-github-bot
authored andcommitted
Gate accessibilityOrder on iOS and Android (facebook#50303)
Summary: This feature is being tested internally right now. We cannot really avoid exposing the type but we are going to make this no-op for now in OSS until we are confident we can roll it out fully Changelog: [Internal] Reviewed By: philIip Differential Revision: D71919847
1 parent 26a6ae0 commit 96e678b

22 files changed

+178
-56
lines changed

Diff for: packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm

+2-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
390390
}
391391
}
392392

393-
if (oldViewProps.accessibilityOrder != newViewProps.accessibilityOrder) {
393+
if (ReactNativeFeatureFlags::enableAccessibilityOrder() &&
394+
oldViewProps.accessibilityOrder != newViewProps.accessibilityOrder) {
394395
_accessibleElementsNativeIds = [NSMutableArray new];
395396
for (const std::string &childId : newViewProps.accessibilityOrder) {
396397
[_accessibleElementsNativeIds addObject:RCTNSStringFromString(childId)];

Diff for: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<762c00f2834ed27d1e74609ea8f26811>>
7+
* @generated SignedSource<<28e3a307300f53f69b5585cc639f0097>>
88
*/
99

1010
/**
@@ -60,6 +60,12 @@ public object ReactNativeFeatureFlags {
6060
@JvmStatic
6161
public fun disableMountItemReorderingAndroid(): Boolean = accessor.disableMountItemReorderingAndroid()
6262

63+
/**
64+
* When enabled, the accessibilityOrder prop will propagate to native platforms and define the accessibility order.
65+
*/
66+
@JvmStatic
67+
public fun enableAccessibilityOrder(): Boolean = accessor.enableAccessibilityOrder()
68+
6369
/**
6470
* When enabled, Android will accumulate updates in rawProps to reduce the number of mounting instructions for cascading re-renders.
6571
*/

Diff for: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt

+11-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<e6c99311c264b44eaebda46f06d7c978>>
7+
* @generated SignedSource<<fedd5579e4fb417bd1ddf9081985f427>>
88
*/
99

1010
/**
@@ -25,6 +25,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
2525
private var cxxNativeAnimatedEnabledCache: Boolean? = null
2626
private var disableMainQueueSyncDispatchIOSCache: Boolean? = null
2727
private var disableMountItemReorderingAndroidCache: Boolean? = null
28+
private var enableAccessibilityOrderCache: Boolean? = null
2829
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
2930
private var enableBridgelessArchitectureCache: Boolean? = null
3031
private var enableCppPropsIteratorSetterCache: Boolean? = null
@@ -106,6 +107,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
106107
return cached
107108
}
108109

110+
override fun enableAccessibilityOrder(): Boolean {
111+
var cached = enableAccessibilityOrderCache
112+
if (cached == null) {
113+
cached = ReactNativeFeatureFlagsCxxInterop.enableAccessibilityOrder()
114+
enableAccessibilityOrderCache = cached
115+
}
116+
return cached
117+
}
118+
109119
override fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean {
110120
var cached = enableAccumulatedUpdatesInRawPropsAndroidCache
111121
if (cached == null) {

Diff for: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<06e72b7cde6cece3c0df4c4c34a48698>>
7+
* @generated SignedSource<<77db50aabc075e6ef133158a9828f52b>>
88
*/
99

1010
/**
@@ -38,6 +38,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
3838

3939
@DoNotStrip @JvmStatic public external fun disableMountItemReorderingAndroid(): Boolean
4040

41+
@DoNotStrip @JvmStatic public external fun enableAccessibilityOrder(): Boolean
42+
4143
@DoNotStrip @JvmStatic public external fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean
4244

4345
@DoNotStrip @JvmStatic public external fun enableBridgelessArchitecture(): Boolean

Diff for: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<7f3dba37b181d001a7f90d2e0e7a6452>>
7+
* @generated SignedSource<<95e258c60535844bc096e6d291785c71>>
88
*/
99

1010
/**
@@ -33,6 +33,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
3333

3434
override fun disableMountItemReorderingAndroid(): Boolean = false
3535

36+
override fun enableAccessibilityOrder(): Boolean = false
37+
3638
override fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean = false
3739

3840
override fun enableBridgelessArchitecture(): Boolean = false

Diff for: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt

+12-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<dc258399eb6bde1d722934615c900d6e>>
7+
* @generated SignedSource<<c8a43244cf7e009b66d8351d1c0afdb7>>
88
*/
99

1010
/**
@@ -29,6 +29,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
2929
private var cxxNativeAnimatedEnabledCache: Boolean? = null
3030
private var disableMainQueueSyncDispatchIOSCache: Boolean? = null
3131
private var disableMountItemReorderingAndroidCache: Boolean? = null
32+
private var enableAccessibilityOrderCache: Boolean? = null
3233
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
3334
private var enableBridgelessArchitectureCache: Boolean? = null
3435
private var enableCppPropsIteratorSetterCache: Boolean? = null
@@ -115,6 +116,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
115116
return cached
116117
}
117118

119+
override fun enableAccessibilityOrder(): Boolean {
120+
var cached = enableAccessibilityOrderCache
121+
if (cached == null) {
122+
cached = currentProvider.enableAccessibilityOrder()
123+
accessedFeatureFlags.add("enableAccessibilityOrder")
124+
enableAccessibilityOrderCache = cached
125+
}
126+
return cached
127+
}
128+
118129
override fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean {
119130
var cached = enableAccumulatedUpdatesInRawPropsAndroidCache
120131
if (cached == null) {

Diff for: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<ea646e2d568b07a11002977b1372d3a7>>
7+
* @generated SignedSource<<659516c334fc1c1a22fc0017ec4b634a>>
88
*/
99

1010
/**
@@ -33,6 +33,8 @@ public interface ReactNativeFeatureFlagsProvider {
3333

3434
@DoNotStrip public fun disableMountItemReorderingAndroid(): Boolean
3535

36+
@DoNotStrip public fun enableAccessibilityOrder(): Boolean
37+
3638
@DoNotStrip public fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean
3739

3840
@DoNotStrip public fun enableBridgelessArchitecture(): Boolean

Diff for: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.facebook.react.bridge.ReadableType;
3030
import com.facebook.react.common.MapBuilder;
3131
import com.facebook.react.common.ReactConstants;
32+
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
3233
import com.facebook.react.uimanager.ReactAccessibilityDelegate.AccessibilityRole;
3334
import com.facebook.react.uimanager.ReactAccessibilityDelegate.Role;
3435
import com.facebook.react.uimanager.annotations.ReactProp;
@@ -303,6 +304,9 @@ public void setNativeId(@NonNull T view, @Nullable String nativeId) {
303304

304305
@ReactProp(name = ViewProps.ACCESSIBILITY_ORDER)
305306
public void setAccessibilityOrder(@NonNull T view, @Nullable ReadableArray nativeIds) {
307+
if (!ReactNativeFeatureFlags.enableAccessibilityOrder()) {
308+
return;
309+
}
306310

307311
view.setTag(R.id.accessibility_order, nativeIds);
308312
view.setTag(R.id.accessibility_order_dirty, true);

Diff for: packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<595cf2b1445869d3ad42b4ff04392201>>
7+
* @generated SignedSource<<c841e4d2f91254ead7f4796471ffb7df>>
88
*/
99

1010
/**
@@ -69,6 +69,12 @@ class ReactNativeFeatureFlagsJavaProvider
6969
return method(javaProvider_);
7070
}
7171

72+
bool enableAccessibilityOrder() override {
73+
static const auto method =
74+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableAccessibilityOrder");
75+
return method(javaProvider_);
76+
}
77+
7278
bool enableAccumulatedUpdatesInRawPropsAndroid() override {
7379
static const auto method =
7480
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableAccumulatedUpdatesInRawPropsAndroid");
@@ -308,6 +314,11 @@ bool JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid(
308314
return ReactNativeFeatureFlags::disableMountItemReorderingAndroid();
309315
}
310316

317+
bool JReactNativeFeatureFlagsCxxInterop::enableAccessibilityOrder(
318+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
319+
return ReactNativeFeatureFlags::enableAccessibilityOrder();
320+
}
321+
311322
bool JReactNativeFeatureFlagsCxxInterop::enableAccumulatedUpdatesInRawPropsAndroid(
312323
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
313324
return ReactNativeFeatureFlags::enableAccumulatedUpdatesInRawPropsAndroid();
@@ -529,6 +540,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
529540
makeNativeMethod(
530541
"disableMountItemReorderingAndroid",
531542
JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid),
543+
makeNativeMethod(
544+
"enableAccessibilityOrder",
545+
JReactNativeFeatureFlagsCxxInterop::enableAccessibilityOrder),
532546
makeNativeMethod(
533547
"enableAccumulatedUpdatesInRawPropsAndroid",
534548
JReactNativeFeatureFlagsCxxInterop::enableAccumulatedUpdatesInRawPropsAndroid),

Diff for: packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<673e6e0a953c30fa0447f085b18bc0e0>>
7+
* @generated SignedSource<<5cba40510e76026bab8aac851946c6a2>>
88
*/
99

1010
/**
@@ -45,6 +45,9 @@ class JReactNativeFeatureFlagsCxxInterop
4545
static bool disableMountItemReorderingAndroid(
4646
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
4747

48+
static bool enableAccessibilityOrder(
49+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
50+
4851
static bool enableAccumulatedUpdatesInRawPropsAndroid(
4952
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
5053

Diff for: packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<b1cd00126d8d7d85a29a4e4926eedb55>>
7+
* @generated SignedSource<<c20566ca0fb97ba9f50cf18f687f2723>>
88
*/
99

1010
/**
@@ -46,6 +46,10 @@ bool ReactNativeFeatureFlags::disableMountItemReorderingAndroid() {
4646
return getAccessor().disableMountItemReorderingAndroid();
4747
}
4848

49+
bool ReactNativeFeatureFlags::enableAccessibilityOrder() {
50+
return getAccessor().enableAccessibilityOrder();
51+
}
52+
4953
bool ReactNativeFeatureFlags::enableAccumulatedUpdatesInRawPropsAndroid() {
5054
return getAccessor().enableAccumulatedUpdatesInRawPropsAndroid();
5155
}

Diff for: packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<2cb475fe28309af74249013e06ea6e69>>
7+
* @generated SignedSource<<e9a8af0faacb2bd1ee4a922851ba0f17>>
88
*/
99

1010
/**
@@ -64,6 +64,11 @@ class ReactNativeFeatureFlags {
6464
*/
6565
RN_EXPORT static bool disableMountItemReorderingAndroid();
6666

67+
/**
68+
* When enabled, the accessibilityOrder prop will propagate to native platforms and define the accessibility order.
69+
*/
70+
RN_EXPORT static bool enableAccessibilityOrder();
71+
6772
/**
6873
* When enabled, Android will accumulate updates in rawProps to reduce the number of mounting instructions for cascading re-renders.
6974
*/

0 commit comments

Comments
 (0)