Skip to content

Commit daeeea4

Browse files
joevilchesfacebook-github-bot
authored andcommitted
Gate accessibilityOrder on iOS and Android (facebook#50303)
Summary: Pull Request resolved: facebook#50303 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] Differential Revision: D71919847
1 parent 13f925b commit daeeea4

22 files changed

+180
-58
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<<8bc15cf2356e248a791c68f134c39a2f>>
7+
* @generated SignedSource<<8cf2af30c9f24da7873b116fc39f44c0>>
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<<92f9ae1833854159495119059d39bba9>>
7+
* @generated SignedSource<<9b17e18d047d33dfbfa1dd6d5c69fd6b>>
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
@@ -108,6 +109,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
108109
return cached
109110
}
110111

112+
override fun enableAccessibilityOrder(): Boolean {
113+
var cached = enableAccessibilityOrderCache
114+
if (cached == null) {
115+
cached = ReactNativeFeatureFlagsCxxInterop.enableAccessibilityOrder()
116+
enableAccessibilityOrderCache = cached
117+
}
118+
return cached
119+
}
120+
111121
override fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean {
112122
var cached = enableAccumulatedUpdatesInRawPropsAndroidCache
113123
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<<af0b3a715e7c2f3059b7e42fc6ccc337>>
7+
* @generated SignedSource<<ea5ccce020ccf100821a338d81c08272>>
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<<b8e277be7a521cbc3c4034d127af0a8a>>
7+
* @generated SignedSource<<ca0d40bd7892c9743427fc5760a8730f>>
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<<fc91518eced3e23036fd853ca3145ec3>>
7+
* @generated SignedSource<<e7ce6f0e7ac8d63ea1a5977c002fea62>>
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
@@ -117,6 +118,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
117118
return cached
118119
}
119120

121+
override fun enableAccessibilityOrder(): Boolean {
122+
var cached = enableAccessibilityOrderCache
123+
if (cached == null) {
124+
cached = currentProvider.enableAccessibilityOrder()
125+
accessedFeatureFlags.add("enableAccessibilityOrder")
126+
enableAccessibilityOrderCache = cached
127+
}
128+
return cached
129+
}
130+
120131
override fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean {
121132
var cached = enableAccumulatedUpdatesInRawPropsAndroidCache
122133
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<<d094e8d5d6d4fdc6de0eb5e7c3677ef6>>
7+
* @generated SignedSource<<334a4cb63da80e46824bf4dc33493265>>
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<<34180cac91373696c9d55316b9faf66c>>
7+
* @generated SignedSource<<7bd5ba2b40291b5f354c4a7babbc356b>>
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");
@@ -320,6 +326,11 @@ bool JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid(
320326
return ReactNativeFeatureFlags::disableMountItemReorderingAndroid();
321327
}
322328

329+
bool JReactNativeFeatureFlagsCxxInterop::enableAccessibilityOrder(
330+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
331+
return ReactNativeFeatureFlags::enableAccessibilityOrder();
332+
}
333+
323334
bool JReactNativeFeatureFlagsCxxInterop::enableAccumulatedUpdatesInRawPropsAndroid(
324335
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
325336
return ReactNativeFeatureFlags::enableAccumulatedUpdatesInRawPropsAndroid();
@@ -551,6 +562,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
551562
makeNativeMethod(
552563
"disableMountItemReorderingAndroid",
553564
JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid),
565+
makeNativeMethod(
566+
"enableAccessibilityOrder",
567+
JReactNativeFeatureFlagsCxxInterop::enableAccessibilityOrder),
554568
makeNativeMethod(
555569
"enableAccumulatedUpdatesInRawPropsAndroid",
556570
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<<b73b48dcf930c8d45ff48fbebe5881f2>>
7+
* @generated SignedSource<<bd74d2e820f240f850a1d524c9984e41>>
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<<637a883106342d65133f54a8e931a5d4>>
7+
* @generated SignedSource<<8f05b713f807eb8eb56a577f27beacb1>>
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<<881026a6a7c333595552737f29539b79>>
7+
* @generated SignedSource<<2212cdc483a1aedb2d73040d4551c023>>
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)