Skip to content

Killswitch accessibilityOrder on iOS and Android #50303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
}
}

if (oldViewProps.accessibilityOrder != newViewProps.accessibilityOrder) {
if (ReactNativeFeatureFlags::enableAccessibilityOrder() &&
oldViewProps.accessibilityOrder != newViewProps.accessibilityOrder) {
_accessibleElementsNativeIds = [NSMutableArray new];
for (const std::string &childId : newViewProps.accessibilityOrder) {
[_accessibleElementsNativeIds addObject:RCTNSStringFromString(childId)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<762c00f2834ed27d1e74609ea8f26811>>
* @generated SignedSource<<28e3a307300f53f69b5585cc639f0097>>
*/

/**
Expand Down Expand Up @@ -60,6 +60,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun disableMountItemReorderingAndroid(): Boolean = accessor.disableMountItemReorderingAndroid()

/**
* When enabled, the accessibilityOrder prop will propagate to native platforms and define the accessibility order.
*/
@JvmStatic
public fun enableAccessibilityOrder(): Boolean = accessor.enableAccessibilityOrder()

/**
* When enabled, Android will accumulate updates in rawProps to reduce the number of mounting instructions for cascading re-renders.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<e6c99311c264b44eaebda46f06d7c978>>
* @generated SignedSource<<fedd5579e4fb417bd1ddf9081985f427>>
*/

/**
Expand All @@ -25,6 +25,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var cxxNativeAnimatedEnabledCache: Boolean? = null
private var disableMainQueueSyncDispatchIOSCache: Boolean? = null
private var disableMountItemReorderingAndroidCache: Boolean? = null
private var enableAccessibilityOrderCache: Boolean? = null
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
private var enableBridgelessArchitectureCache: Boolean? = null
private var enableCppPropsIteratorSetterCache: Boolean? = null
Expand Down Expand Up @@ -106,6 +107,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun enableAccessibilityOrder(): Boolean {
var cached = enableAccessibilityOrderCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableAccessibilityOrder()
enableAccessibilityOrderCache = cached
}
return cached
}

override fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean {
var cached = enableAccumulatedUpdatesInRawPropsAndroidCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<06e72b7cde6cece3c0df4c4c34a48698>>
* @generated SignedSource<<77db50aabc075e6ef133158a9828f52b>>
*/

/**
Expand Down Expand Up @@ -38,6 +38,8 @@ public object ReactNativeFeatureFlagsCxxInterop {

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

@DoNotStrip @JvmStatic public external fun enableAccessibilityOrder(): Boolean

@DoNotStrip @JvmStatic public external fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean

@DoNotStrip @JvmStatic public external fun enableBridgelessArchitecture(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<7f3dba37b181d001a7f90d2e0e7a6452>>
* @generated SignedSource<<95e258c60535844bc096e6d291785c71>>
*/

/**
Expand Down Expand Up @@ -33,6 +33,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun disableMountItemReorderingAndroid(): Boolean = false

override fun enableAccessibilityOrder(): Boolean = false

override fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean = false

override fun enableBridgelessArchitecture(): Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<dc258399eb6bde1d722934615c900d6e>>
* @generated SignedSource<<c8a43244cf7e009b66d8351d1c0afdb7>>
*/

/**
Expand All @@ -29,6 +29,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var cxxNativeAnimatedEnabledCache: Boolean? = null
private var disableMainQueueSyncDispatchIOSCache: Boolean? = null
private var disableMountItemReorderingAndroidCache: Boolean? = null
private var enableAccessibilityOrderCache: Boolean? = null
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
private var enableBridgelessArchitectureCache: Boolean? = null
private var enableCppPropsIteratorSetterCache: Boolean? = null
Expand Down Expand Up @@ -115,6 +116,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

override fun enableAccessibilityOrder(): Boolean {
var cached = enableAccessibilityOrderCache
if (cached == null) {
cached = currentProvider.enableAccessibilityOrder()
accessedFeatureFlags.add("enableAccessibilityOrder")
enableAccessibilityOrderCache = cached
}
return cached
}

override fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean {
var cached = enableAccumulatedUpdatesInRawPropsAndroidCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<ea646e2d568b07a11002977b1372d3a7>>
* @generated SignedSource<<659516c334fc1c1a22fc0017ec4b634a>>
*/

/**
Expand Down Expand Up @@ -33,6 +33,8 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun disableMountItemReorderingAndroid(): Boolean

@DoNotStrip public fun enableAccessibilityOrder(): Boolean

@DoNotStrip public fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean

@DoNotStrip public fun enableBridgelessArchitecture(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.facebook.react.bridge.ReadableType;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
import com.facebook.react.uimanager.ReactAccessibilityDelegate.AccessibilityRole;
import com.facebook.react.uimanager.ReactAccessibilityDelegate.Role;
import com.facebook.react.uimanager.annotations.ReactProp;
Expand Down Expand Up @@ -303,6 +304,9 @@ public void setNativeId(@NonNull T view, @Nullable String nativeId) {

@ReactProp(name = ViewProps.ACCESSIBILITY_ORDER)
public void setAccessibilityOrder(@NonNull T view, @Nullable ReadableArray nativeIds) {
if (!ReactNativeFeatureFlags.enableAccessibilityOrder()) {
return;
}

view.setTag(R.id.accessibility_order, nativeIds);
view.setTag(R.id.accessibility_order_dirty, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<595cf2b1445869d3ad42b4ff04392201>>
* @generated SignedSource<<c841e4d2f91254ead7f4796471ffb7df>>
*/

/**
Expand Down Expand Up @@ -69,6 +69,12 @@ class ReactNativeFeatureFlagsJavaProvider
return method(javaProvider_);
}

bool enableAccessibilityOrder() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableAccessibilityOrder");
return method(javaProvider_);
}

bool enableAccumulatedUpdatesInRawPropsAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableAccumulatedUpdatesInRawPropsAndroid");
Expand Down Expand Up @@ -308,6 +314,11 @@ bool JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid(
return ReactNativeFeatureFlags::disableMountItemReorderingAndroid();
}

bool JReactNativeFeatureFlagsCxxInterop::enableAccessibilityOrder(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableAccessibilityOrder();
}

bool JReactNativeFeatureFlagsCxxInterop::enableAccumulatedUpdatesInRawPropsAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableAccumulatedUpdatesInRawPropsAndroid();
Expand Down Expand Up @@ -529,6 +540,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"disableMountItemReorderingAndroid",
JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid),
makeNativeMethod(
"enableAccessibilityOrder",
JReactNativeFeatureFlagsCxxInterop::enableAccessibilityOrder),
makeNativeMethod(
"enableAccumulatedUpdatesInRawPropsAndroid",
JReactNativeFeatureFlagsCxxInterop::enableAccumulatedUpdatesInRawPropsAndroid),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<673e6e0a953c30fa0447f085b18bc0e0>>
* @generated SignedSource<<5cba40510e76026bab8aac851946c6a2>>
*/

/**
Expand Down Expand Up @@ -45,6 +45,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool disableMountItemReorderingAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool enableAccessibilityOrder(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool enableAccumulatedUpdatesInRawPropsAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<b1cd00126d8d7d85a29a4e4926eedb55>>
* @generated SignedSource<<c20566ca0fb97ba9f50cf18f687f2723>>
*/

/**
Expand Down Expand Up @@ -46,6 +46,10 @@ bool ReactNativeFeatureFlags::disableMountItemReorderingAndroid() {
return getAccessor().disableMountItemReorderingAndroid();
}

bool ReactNativeFeatureFlags::enableAccessibilityOrder() {
return getAccessor().enableAccessibilityOrder();
}

bool ReactNativeFeatureFlags::enableAccumulatedUpdatesInRawPropsAndroid() {
return getAccessor().enableAccumulatedUpdatesInRawPropsAndroid();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<2cb475fe28309af74249013e06ea6e69>>
* @generated SignedSource<<e9a8af0faacb2bd1ee4a922851ba0f17>>
*/

/**
Expand Down Expand Up @@ -64,6 +64,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool disableMountItemReorderingAndroid();

/**
* When enabled, the accessibilityOrder prop will propagate to native platforms and define the accessibility order.
*/
RN_EXPORT static bool enableAccessibilityOrder();

/**
* When enabled, Android will accumulate updates in rawProps to reduce the number of mounting instructions for cascading re-renders.
*/
Expand Down
Loading
Loading