Skip to content

Commit aec934a

Browse files
authored
Remove form event delegation flag (#19395)
1 parent a59f899 commit aec934a

11 files changed

Lines changed: 6 additions & 31 deletions

packages/react-dom/src/__tests__/ReactDOMEventListener-test.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,10 @@ describe('ReactDOMEventListener', () => {
278278
document.body.removeChild(container);
279279
});
280280

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', () => {
285285
const container = document.createElement('div');
286286
document.body.appendChild(container);
287287

@@ -316,13 +316,8 @@ describe('ReactDOMEventListener', () => {
316316
}),
317317
);
318318

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();
326321
} finally {
327322
document.body.removeChild(container);
328323
}

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ import {
4343
TOP_INVALID,
4444
TOP_SCROLL,
4545
TOP_CLOSE,
46-
TOP_RESET,
47-
TOP_SUBMIT,
4846
TOP_CAN_PLAY,
4947
TOP_CAN_PLAY_THROUGH,
5048
TOP_DURATION_CHANGE,
@@ -83,7 +81,6 @@ import getListener from './getListener';
8381
import {passiveBrowserEventsSupported} from './checkPassiveEvents';
8482

8583
import {
86-
enableFormEventDelegation,
8784
enableLegacyFBSupport,
8885
enableCreateEventHandleAPI,
8986
enableScopeAPI,
@@ -244,11 +241,6 @@ export const capturePhaseEvents: Set<DOMTopLevelEventType> = new Set([
244241
TOP_WAITING,
245242
]);
246243

247-
if (!enableFormEventDelegation) {
248-
capturePhaseEvents.add(TOP_SUBMIT);
249-
capturePhaseEvents.add(TOP_RESET);
250-
}
251-
252244
if (enableCreateEventHandleAPI) {
253245
capturePhaseEvents.add(TOP_AFTER_BLUR);
254246
}

packages/shared/ReactFeatureFlags.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,3 @@ export const deferRenderPhaseUpdateToNextBatch = true;
127127

128128
// Replacement for runWithPriority in React internals.
129129
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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export const warnAboutSpreadingKeyToJSX = false;
4444
export const enableComponentStackLocations = false;
4545
export const enableLegacyFBSupport = false;
4646
export const enableFilterEmptyStringAttributesDOM = false;
47-
export const enableFormEventDelegation = false;
4847

4948
export const enableNewReconciler = false;
5049
export const deferRenderPhaseUpdateToNextBatch = true;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
4343
export const enableComponentStackLocations = false;
4444
export const enableLegacyFBSupport = false;
4545
export const enableFilterEmptyStringAttributesDOM = false;
46-
export const enableFormEventDelegation = false;
4746

4847
export const enableNewReconciler = false;
4948
export const deferRenderPhaseUpdateToNextBatch = true;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
4343
export const enableComponentStackLocations = true;
4444
export const enableLegacyFBSupport = false;
4545
export const enableFilterEmptyStringAttributesDOM = false;
46-
export const enableFormEventDelegation = false;
4746

4847
export const enableNewReconciler = false;
4948
export const deferRenderPhaseUpdateToNextBatch = true;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
4343
export const enableComponentStackLocations = true;
4444
export const enableLegacyFBSupport = false;
4545
export const enableFilterEmptyStringAttributesDOM = false;
46-
export const enableFormEventDelegation = false;
4746

4847
export const enableNewReconciler = false;
4948
export const deferRenderPhaseUpdateToNextBatch = true;

packages/shared/forks/ReactFeatureFlags.testing.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
4343
export const enableComponentStackLocations = true;
4444
export const enableLegacyFBSupport = false;
4545
export const enableFilterEmptyStringAttributesDOM = false;
46-
export const enableFormEventDelegation = false;
4746

4847
export const enableNewReconciler = false;
4948
export const deferRenderPhaseUpdateToNextBatch = true;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
4343
export const enableComponentStackLocations = true;
4444
export const enableLegacyFBSupport = !__EXPERIMENTAL__;
4545
export const enableFilterEmptyStringAttributesDOM = false;
46-
export const enableFormEventDelegation = false;
4746

4847
export const enableNewReconciler = false;
4948
export const deferRenderPhaseUpdateToNextBatch = true;

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,3 @@ export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__;
4343
// to __VARIANT__.
4444
export const enableTrustedTypesIntegration = false;
4545
export const disableSchedulerTimeoutBasedOnReactExpirationTime = false;
46-
47-
export const enableFormEventDelegation = __VARIANT__;

0 commit comments

Comments
 (0)