Remove form event delegation flag (#19395)
Dan Abramov committed
Jul 17, 2020 at 14:19 UTC
aec934af7f182e0bda910f64972722b147a68657
11 files changed
+6
-31
packages/react-dom/src/__tests__/ReactDOMEventListener-test.js
+6
-11
@@ -278,10 +278,10 @@ describe('ReactDOMEventListener', () => {
278
document.body.removeChild(container);
279
});
280
281
- // This is a special case for submit and reset events as they are listened on
282
- // at the element level and not the document.
283
- // @see https://github.com/facebook/react/pull/13462
284
- it('should (or not) receive submit events if native, interim DOM handler prevents it', () => {
281
+ // This tests an implementation detail that submit/reset events are listened to
282
+ // at the document level, which is necessary for event replaying to work.
283
+ // They bubble in all modern browsers.
284
+ it('should not receive submit events if native, interim DOM handler prevents it', () => {
285
const container = document.createElement('div');
286
document.body.appendChild(container);
287
@@ -316,13 +316,8 @@ describe('ReactDOMEventListener', () => {
316
}),
317
);
318
319
- if (gate(flags => flags.enableFormEventDelegation)) {
320
- expect(handleSubmit).not.toHaveBeenCalled();
321
- expect(handleReset).not.toHaveBeenCalled();
322
- } else {
323
- expect(handleSubmit).toHaveBeenCalled();
324
- expect(handleReset).toHaveBeenCalled();
325
- }
319
+ expect(handleSubmit).not.toHaveBeenCalled();
320
+ expect(handleReset).not.toHaveBeenCalled();
321
} finally {
322
document.body.removeChild(container);
323
}
packages/react-dom/src/events/DOMModernPluginEventSystem.js
-8
@@ -43,8 +43,6 @@ import {
43
TOP_INVALID,
44
TOP_SCROLL,
45
TOP_CLOSE,
46
- TOP_RESET,
47
- TOP_SUBMIT,
46
TOP_CAN_PLAY,
47
TOP_CAN_PLAY_THROUGH,
48
TOP_DURATION_CHANGE,
@@ -83,7 +81,6 @@ import getListener from './getListener';
81
import {passiveBrowserEventsSupported} from './checkPassiveEvents';
82
83
import {
86
- enableFormEventDelegation,
84
enableLegacyFBSupport,
85
enableCreateEventHandleAPI,
86
enableScopeAPI,
@@ -244,11 +241,6 @@ export const capturePhaseEvents: Set<DOMTopLevelEventType> = new Set([
241
TOP_WAITING,
242
]);
243
247
-if (!enableFormEventDelegation) {
248
- capturePhaseEvents.add(TOP_SUBMIT);
249
- capturePhaseEvents.add(TOP_RESET);
250
-}
251
-
244
if (enableCreateEventHandleAPI) {
245
capturePhaseEvents.add(TOP_AFTER_BLUR);
246
}
packages/shared/ReactFeatureFlags.js
-3
@@ -127,6 +127,3 @@ export const deferRenderPhaseUpdateToNextBatch = true;
127
128
// Replacement for runWithPriority in React internals.
129
export const decoupleUpdatePriorityFromScheduler = false;
130
-
131
-// Enables delegation for submit and reset events.
132
-export const enableFormEventDelegation = false;
packages/shared/forks/ReactFeatureFlags.native-fb.js
-1
@@ -44,7 +44,6 @@ export const warnAboutSpreadingKeyToJSX = false;
44
export const enableComponentStackLocations = false;
45
export const enableLegacyFBSupport = false;
46
export const enableFilterEmptyStringAttributesDOM = false;
47
-export const enableFormEventDelegation = false;
47
48
export const enableNewReconciler = false;
49
export const deferRenderPhaseUpdateToNextBatch = true;
packages/shared/forks/ReactFeatureFlags.native-oss.js
-1
@@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
43
export const enableComponentStackLocations = false;
44
export const enableLegacyFBSupport = false;
45
export const enableFilterEmptyStringAttributesDOM = false;
46
-export const enableFormEventDelegation = false;
46
47
export const enableNewReconciler = false;
48
export const deferRenderPhaseUpdateToNextBatch = true;
packages/shared/forks/ReactFeatureFlags.test-renderer.js
-1
@@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
43
export const enableComponentStackLocations = true;
44
export const enableLegacyFBSupport = false;
45
export const enableFilterEmptyStringAttributesDOM = false;
46
-export const enableFormEventDelegation = false;
46
47
export const enableNewReconciler = false;
48
export const deferRenderPhaseUpdateToNextBatch = true;
packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
-1
@@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
43
export const enableComponentStackLocations = true;
44
export const enableLegacyFBSupport = false;
45
export const enableFilterEmptyStringAttributesDOM = false;
46
-export const enableFormEventDelegation = false;
46
47
export const enableNewReconciler = false;
48
export const deferRenderPhaseUpdateToNextBatch = true;
packages/shared/forks/ReactFeatureFlags.testing.js
-1
@@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
43
export const enableComponentStackLocations = true;
44
export const enableLegacyFBSupport = false;
45
export const enableFilterEmptyStringAttributesDOM = false;
46
-export const enableFormEventDelegation = false;
46
47
export const enableNewReconciler = false;
48
export const deferRenderPhaseUpdateToNextBatch = true;
packages/shared/forks/ReactFeatureFlags.testing.www.js
-1
@@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
43
export const enableComponentStackLocations = true;
44
export const enableLegacyFBSupport = !__EXPERIMENTAL__;
45
export const enableFilterEmptyStringAttributesDOM = false;
46
-export const enableFormEventDelegation = false;
46
47
export const enableNewReconciler = false;
48
export const deferRenderPhaseUpdateToNextBatch = true;
packages/shared/forks/ReactFeatureFlags.www-dynamic.js
-2
@@ -43,5 +43,3 @@ export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__;
43
// to __VARIANT__.
44
export const enableTrustedTypesIntegration = false;
45
export const disableSchedulerTimeoutBasedOnReactExpirationTime = false;
46
-
47
-export const enableFormEventDelegation = __VARIANT__;
packages/shared/forks/ReactFeatureFlags.www.js
-1
@@ -27,7 +27,6 @@ export const {
27
decoupleUpdatePriorityFromScheduler,
28
enableDebugTracing,
29
enableSchedulingProfiler,
30
- enableFormEventDelegation,
30
} = dynamicFeatureFlags;
31
32
// On WWW, __EXPERIMENTAL__ is used for a new modern build.