@samitouri / QOS-React / commits / e9721e14e4

Remove onScroll bubbling flag (#19535)

Dan Abramov committed Aug 5, 2020 at 16:07 UTC e9721e14e4b8776c107afa3cdd7c6d664fe20c24
12 files changed +14 -46
packages/react-dom/src/__tests__/ReactDOMEventListener-test.js
+6 -17
@@ -712,23 +712,12 @@ describe('ReactDOMEventListener', () => {
712 bubbles: false,
713 }),
714 );
715 - if (gate(flags => flags.disableOnScrollBubbling)) {
716 - expect(log).toEqual([
717 - ['capture', 'grand'],
718 - ['capture', 'parent'],
719 - ['capture', 'child'],
720 - ['bubble', 'child'],
721 - ]);
722 - } else {
723 - expect(log).toEqual([
724 - ['capture', 'grand'],
725 - ['capture', 'parent'],
726 - ['capture', 'child'],
727 - ['bubble', 'child'],
728 - ['bubble', 'parent'],
729 - ['bubble', 'grand'],
730 - ]);
731 - }
715 + expect(log).toEqual([
716 + ['capture', 'grand'],
717 + ['capture', 'parent'],
718 + ['capture', 'child'],
719 + ['bubble', 'child'],
720 + ]);
721 } finally {
722 document.body.removeChild(container);
723 }
packages/react-dom/src/__tests__/ReactDOMEventPropagation-test.js
-6
@@ -1154,12 +1154,6 @@ describe('ReactDOMEventListener', () => {
1154 });
1155
1156 describe('non-bubbling events that do not bubble in React', () => {
1157 - // This test will fail outside of the no-bubbling flag
1158 - // because its bubbling emulation is currently broken.
1159 - // In particular, if the target itself doesn't have
1160 - // a handler, it will not emulate bubbling correctly.
1161 - // Instead of fixing this, we'll just turn this flag on.
1162 - // @gate disableOnScrollBubbling
1157 it('onScroll', () => {
1158 testNonBubblingEvent({
1159 type: 'div',
packages/react-dom/src/events/plugins/SimpleEventPlugin.js
+8 -13
@@ -47,10 +47,7 @@ import {IS_EVENT_HANDLE_NON_MANAGED_NODE} from '../EventSystemFlags';
47 import getEventCharCode from '../getEventCharCode';
48 import {IS_CAPTURE_PHASE} from '../EventSystemFlags';
49
50 -import {
51 - enableCreateEventHandleAPI,
52 - disableOnScrollBubbling,
53 -} from 'shared/ReactFeatureFlags';
50 +import {enableCreateEventHandleAPI} from 'shared/ReactFeatureFlags';
51
52 function extractEvents(
53 dispatchQueue: DispatchQueue,
@@ -177,15 +174,13 @@ function extractEvents(
174 // In the past, React has always bubbled them, but this can be surprising.
175 // We're going to try aligning closer to the browser behavior by not bubbling
176 // them in React either. We'll start by not bubbling onScroll, and then expand.
180 - let accumulateTargetOnly = false;
181 - if (disableOnScrollBubbling) {
182 - accumulateTargetOnly =
183 - !inCapturePhase &&
184 - // TODO: ideally, we'd eventually add all events from
185 - // nonDelegatedEvents list in DOMPluginEventSystem.
186 - // Then we can remove this special list.
187 - domEventName === 'scroll';
188 - }
177 + const accumulateTargetOnly =
178 + !inCapturePhase &&
179 + // TODO: ideally, we'd eventually add all events from
180 + // nonDelegatedEvents list in DOMPluginEventSystem.
181 + // Then we can remove this special list.
182 + // This is a breaking change that can wait until React 18.
183 + domEventName === 'scroll';
184
185 accumulateSinglePhaseListeners(
186 targetInst,
packages/shared/ReactFeatureFlags.js
-2
@@ -125,5 +125,3 @@ export const deferRenderPhaseUpdateToNextBatch = true;
125
126 // Replacement for runWithPriority in React internals.
127 export const decoupleUpdatePriorityFromScheduler = false;
128 -
129 -export const disableOnScrollBubbling = true;
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 disableOnScrollBubbling = true;
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 disableOnScrollBubbling = true;
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 disableOnScrollBubbling = true;
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 disableOnScrollBubbling = true;
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 disableOnScrollBubbling = true;
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 disableOnScrollBubbling = true;
46
47 export const enableNewReconciler = false;
48 export const deferRenderPhaseUpdateToNextBatch = true;
packages/shared/forks/ReactFeatureFlags.www-dynamic.js
-1
@@ -18,7 +18,6 @@ export const disableInputAttributeSyncing = __VARIANT__;
18 export const enableFilterEmptyStringAttributesDOM = __VARIANT__;
19 export const enableLegacyFBSupport = __VARIANT__;
20 export const decoupleUpdatePriorityFromScheduler = __VARIANT__;
21 -export const disableOnScrollBubbling = __VARIANT__;
21
22 // Enable this flag to help with concurrent mode debugging.
23 // It logs information to the console about React scheduling, rendering, and commit phases.
packages/shared/forks/ReactFeatureFlags.www.js
-1
@@ -27,7 +27,6 @@ export const {
27 decoupleUpdatePriorityFromScheduler,
28 enableDebugTracing,
29 enableSchedulingProfilerComponentStacks,
30 - disableOnScrollBubbling,
30 } = dynamicFeatureFlags;
31
32 // On WWW, __EXPERIMENTAL__ is used for a new modern build.