Skip to content

Commit 31deb7f

Browse files
committed
Put it behind a feature flag on WWW
1 parent a6cf3d3 commit 31deb7f

12 files changed

+19
-2
lines changed

packages/react-dom/src/events/DOMPluginEventSystem.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import {
5353
enableLegacyFBSupport,
5454
enableCreateEventHandleAPI,
5555
enableScopeAPI,
56+
enablePassiveEventIntervention,
5657
} from 'shared/ReactFeatureFlags';
5758
import {
5859
invokeGuardedCallbackAndCatchFirstError,
@@ -342,7 +343,7 @@ export function listenToNativeEvent(
342343
if (domEventName === 'selectionchange') {
343344
target = (rootContainerElement: any).ownerDocument;
344345
}
345-
if (isPassiveListener === undefined) {
346+
if (enablePassiveEventIntervention && isPassiveListener === undefined) {
346347
// Browsers introduced an intervention, making these events
347348
// passive by default on document. React doesn't bind them
348349
// to document anymore, but changing this now would undo

packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,11 @@ describe('SimpleEventPlugin', function() {
537537
container,
538538
);
539539

540-
expect(passiveEvents).toEqual(['touchstart', 'touchmove', 'wheel']);
540+
if (gate(flags => flags.enablePassiveEventIntervention)) {
541+
expect(passiveEvents).toEqual(['touchstart', 'touchmove', 'wheel']);
542+
} else {
543+
expect(passiveEvents).toEqual([]);
544+
}
541545
});
542546
});
543547
});

packages/shared/ReactFeatureFlags.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,6 @@ export const deferRenderPhaseUpdateToNextBatch = true;
132132
export const decoupleUpdatePriorityFromScheduler = false;
133133

134134
export const enableDiscreteEventFlushingChange = false;
135+
136+
// https://github.com/facebook/react/pull/19654
137+
export const enablePassiveEventIntervention = true;

packages/shared/forks/ReactFeatureFlags.native-fb.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const enableNewReconciler = false;
4949
export const deferRenderPhaseUpdateToNextBatch = true;
5050
export const decoupleUpdatePriorityFromScheduler = false;
5151
export const enableDiscreteEventFlushingChange = false;
52+
export const enablePassiveEventIntervention = true;
5253

5354
// Flow magic to verify the exports of this file match the original version.
5455
// eslint-disable-next-line no-unused-vars

packages/shared/forks/ReactFeatureFlags.native-oss.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const enableNewReconciler = false;
4848
export const deferRenderPhaseUpdateToNextBatch = true;
4949
export const decoupleUpdatePriorityFromScheduler = false;
5050
export const enableDiscreteEventFlushingChange = false;
51+
export const enablePassiveEventIntervention = true;
5152

5253
// Flow magic to verify the exports of this file match the original version.
5354
// eslint-disable-next-line no-unused-vars

packages/shared/forks/ReactFeatureFlags.test-renderer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const enableNewReconciler = false;
4848
export const deferRenderPhaseUpdateToNextBatch = true;
4949
export const decoupleUpdatePriorityFromScheduler = false;
5050
export const enableDiscreteEventFlushingChange = false;
51+
export const enablePassiveEventIntervention = true;
5152

5253
// Flow magic to verify the exports of this file match the original version.
5354
// eslint-disable-next-line no-unused-vars

packages/shared/forks/ReactFeatureFlags.test-renderer.native.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const enableNewReconciler = false;
4848
export const deferRenderPhaseUpdateToNextBatch = true;
4949
export const decoupleUpdatePriorityFromScheduler = false;
5050
export const enableDiscreteEventFlushingChange = false;
51+
export const enablePassiveEventIntervention = true;
5152

5253
// Flow magic to verify the exports of this file match the original version.
5354
// eslint-disable-next-line no-unused-vars

packages/shared/forks/ReactFeatureFlags.test-renderer.www.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const enableNewReconciler = false;
4848
export const deferRenderPhaseUpdateToNextBatch = true;
4949
export const decoupleUpdatePriorityFromScheduler = false;
5050
export const enableDiscreteEventFlushingChange = false;
51+
export const enablePassiveEventIntervention = true;
5152

5253
// Flow magic to verify the exports of this file match the original version.
5354
// eslint-disable-next-line no-unused-vars

packages/shared/forks/ReactFeatureFlags.testing.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const enableNewReconciler = false;
4848
export const deferRenderPhaseUpdateToNextBatch = true;
4949
export const decoupleUpdatePriorityFromScheduler = false;
5050
export const enableDiscreteEventFlushingChange = false;
51+
export const enablePassiveEventIntervention = true;
5152

5253
// Flow magic to verify the exports of this file match the original version.
5354
// eslint-disable-next-line no-unused-vars

packages/shared/forks/ReactFeatureFlags.testing.www.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const enableNewReconciler = false;
4848
export const deferRenderPhaseUpdateToNextBatch = true;
4949
export const decoupleUpdatePriorityFromScheduler = false;
5050
export const enableDiscreteEventFlushingChange = true;
51+
export const enablePassiveEventIntervention = true;
5152

5253
// Flow magic to verify the exports of this file match the original version.
5354
// eslint-disable-next-line no-unused-vars

packages/shared/forks/ReactFeatureFlags.www-dynamic.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const enableFilterEmptyStringAttributesDOM = __VARIANT__;
1919
export const enableLegacyFBSupport = __VARIANT__;
2020
export const decoupleUpdatePriorityFromScheduler = __VARIANT__;
2121
export const skipUnmountedBoundaries = __VARIANT__;
22+
export const enablePassiveEventIntervention = __VARIANT__;
2223

2324
// Enable this flag to help with concurrent mode debugging.
2425
// It logs information to the console about React scheduling, rendering, and commit phases.

packages/shared/forks/ReactFeatureFlags.www.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const {
2727
decoupleUpdatePriorityFromScheduler,
2828
enableDebugTracing,
2929
skipUnmountedBoundaries,
30+
enablePassiveEventIntervention,
3031
} = dynamicFeatureFlags;
3132

3233
// On WWW, __EXPERIMENTAL__ is used for a new modern build.

0 commit comments

Comments
 (0)