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

0 commit comments

Comments
 (0)