Skip to content

Commit e9721e1

Browse files
authored
Remove onScroll bubbling flag (#19535)
1 parent b61174f commit e9721e1

12 files changed

+14
-46
lines changed

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

+6-17
Original file line numberDiff line numberDiff line change
@@ -712,23 +712,12 @@ describe('ReactDOMEventListener', () => {
712712
bubbles: false,
713713
}),
714714
);
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+
]);
732721
} finally {
733722
document.body.removeChild(container);
734723
}

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

-6
Original file line numberDiff line numberDiff line change
@@ -1154,12 +1154,6 @@ describe('ReactDOMEventListener', () => {
11541154
});
11551155

11561156
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
11631157
it('onScroll', () => {
11641158
testNonBubblingEvent({
11651159
type: 'div',

packages/react-dom/src/events/plugins/SimpleEventPlugin.js

+8-13
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ import {IS_EVENT_HANDLE_NON_MANAGED_NODE} from '../EventSystemFlags';
4747
import getEventCharCode from '../getEventCharCode';
4848
import {IS_CAPTURE_PHASE} from '../EventSystemFlags';
4949

50-
import {
51-
enableCreateEventHandleAPI,
52-
disableOnScrollBubbling,
53-
} from 'shared/ReactFeatureFlags';
50+
import {enableCreateEventHandleAPI} from 'shared/ReactFeatureFlags';
5451

5552
function extractEvents(
5653
dispatchQueue: DispatchQueue,
@@ -177,15 +174,13 @@ function extractEvents(
177174
// In the past, React has always bubbled them, but this can be surprising.
178175
// We're going to try aligning closer to the browser behavior by not bubbling
179176
// 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';
189184

190185
accumulateSinglePhaseListeners(
191186
targetInst,

packages/shared/ReactFeatureFlags.js

-2
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,3 @@ export const deferRenderPhaseUpdateToNextBatch = true;
125125

126126
// Replacement for runWithPriority in React internals.
127127
export const decoupleUpdatePriorityFromScheduler = false;
128-
129-
export const disableOnScrollBubbling = true;

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

-1
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 disableOnScrollBubbling = true;
4847

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

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

-1
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 disableOnScrollBubbling = true;
4746

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

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

-1
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 disableOnScrollBubbling = true;
4746

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

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

-1
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 disableOnScrollBubbling = true;
4746

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

packages/shared/forks/ReactFeatureFlags.testing.js

-1
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 disableOnScrollBubbling = true;
4746

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

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

-1
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 disableOnScrollBubbling = true;
4746

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

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

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export const disableInputAttributeSyncing = __VARIANT__;
1818
export const enableFilterEmptyStringAttributesDOM = __VARIANT__;
1919
export const enableLegacyFBSupport = __VARIANT__;
2020
export const decoupleUpdatePriorityFromScheduler = __VARIANT__;
21-
export const disableOnScrollBubbling = __VARIANT__;
2221

2322
// Enable this flag to help with concurrent mode debugging.
2423
// It logs information to the console about React scheduling, rendering, and commit phases.

packages/shared/forks/ReactFeatureFlags.www.js

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export const {
2727
decoupleUpdatePriorityFromScheduler,
2828
enableDebugTracing,
2929
enableSchedulingProfilerComponentStacks,
30-
disableOnScrollBubbling,
3130
} = dynamicFeatureFlags;
3231

3332
// On WWW, __EXPERIMENTAL__ is used for a new modern build.

0 commit comments

Comments
 (0)