Skip to content

Commit

Permalink
Remove passive intervention flag (#19849)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Sep 17, 2020
1 parent 36df918 commit 6fddca2
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 37 deletions.
3 changes: 1 addition & 2 deletions packages/react-dom/src/events/DOMPluginEventSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import {
enableLegacyFBSupport,
enableCreateEventHandleAPI,
enableScopeAPI,
enablePassiveEventIntervention,
enableEagerRootListeners,
} from 'shared/ReactFeatureFlags';
import {
Expand Down Expand Up @@ -481,7 +480,7 @@ function addTrappedEventListener(
// If passive option is not supported, then the event will be
// active and not passive.
let isPassiveListener = undefined;
if (enablePassiveEventIntervention && passiveBrowserEventsSupported) {
if (passiveBrowserEventsSupported) {
// Browsers introduced an intervention, making these events
// passive by default on document. React doesn't bind them
// to document anymore, but changing this now would undo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3070,15 +3070,7 @@ describe('DOMPluginEventSystem', () => {

expect(allEvents).toEqual(['touchstart', 'touchmove', 'wheel']);
// These events are passive by default, so we can't preventDefault.
if (gate(flags => flags.enablePassiveEventIntervention)) {
expect(defaultPreventedEvents).toEqual([]);
} else {
expect(defaultPreventedEvents).toEqual([
'touchstart',
'touchmove',
'wheel',
]);
}
expect(defaultPreventedEvents).toEqual([]);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,21 +534,17 @@ describe('SimpleEventPlugin', function() {
container,
);

if (gate(flags => flags.enablePassiveEventIntervention)) {
if (gate(flags => flags.enableEagerRootListeners)) {
expect(passiveEvents).toEqual([
'touchstart',
'touchstart',
'touchmove',
'touchmove',
'wheel',
'wheel',
]);
} else {
expect(passiveEvents).toEqual(['touchstart', 'touchmove', 'wheel']);
}
if (gate(flags => flags.enableEagerRootListeners)) {
expect(passiveEvents).toEqual([
'touchstart',
'touchstart',
'touchmove',
'touchmove',
'wheel',
'wheel',
]);
} else {
expect(passiveEvents).toEqual([]);
expect(passiveEvents).toEqual(['touchstart', 'touchmove', 'wheel']);
}
});
});
Expand Down
3 changes: 0 additions & 3 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ export const decoupleUpdatePriorityFromScheduler = false;

export const enableDiscreteEventFlushingChange = false;

// https://github.com/facebook/react/pull/19654
export const enablePassiveEventIntervention = true;

export const enableEagerRootListeners = true;

export const disableSchedulerTimeoutInWorkLoop = false;
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.native-fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = false;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;

Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.native-oss.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = false;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;

Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.test-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = false;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = false;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = false;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;

Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = false;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;

Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.testing.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = true;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;

Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.www-dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const enableFilterEmptyStringAttributesDOM = __VARIANT__;
export const enableLegacyFBSupport = __VARIANT__;
export const decoupleUpdatePriorityFromScheduler = __VARIANT__;
export const skipUnmountedBoundaries = __VARIANT__;
export const enablePassiveEventIntervention = __VARIANT__;
export const enableEagerRootListeners = !__VARIANT__;

// Enable this flag to help with concurrent mode debugging.
Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const {
decoupleUpdatePriorityFromScheduler,
enableDebugTracing,
skipUnmountedBoundaries,
enablePassiveEventIntervention,
enableEagerRootListeners,
disableSchedulerTimeoutInWorkLoop,
} = dynamicFeatureFlags;
Expand Down

0 comments on commit 6fddca2

Please sign in to comment.