@@ -47,7 +47,10 @@ import {IS_EVENT_HANDLE_NON_MANAGED_NODE} from '../EventSystemFlags';
47
47
import getEventCharCode from '../getEventCharCode' ;
48
48
import { IS_CAPTURE_PHASE } from '../EventSystemFlags' ;
49
49
50
- import { enableCreateEventHandleAPI } from 'shared/ReactFeatureFlags' ;
50
+ import {
51
+ enableCreateEventHandleAPI ,
52
+ disableOnScrollBubbling ,
53
+ } from 'shared/ReactFeatureFlags' ;
51
54
52
55
function extractEvents (
53
56
dispatchQueue : DispatchQueue ,
@@ -182,13 +185,15 @@ function extractEvents(
182
185
// In the past, React has always bubbled them, but this can be surprising.
183
186
// We're going to try aligning closer to the browser behavior by not bubbling
184
187
// them in React either. We'll start by not bubbling onScroll, and then expand.
185
- const accumulateTargetOnly =
186
- ! inCapturePhase &&
187
- // TODO: ideally, we'd eventually add all events from
188
- // nonDelegatedEvents list in DOMPluginEventSystem.
189
- // Then we can remove this special list.
190
- // This is a breaking change that can wait until React 18.
191
- domEventName === 'scroll' ;
188
+ let accumulateTargetOnly = false ;
189
+ if ( disableOnScrollBubbling ) {
190
+ accumulateTargetOnly =
191
+ ! inCapturePhase &&
192
+ // TODO: ideally, we'd eventually add all events from
193
+ // nonDelegatedEvents list in DOMPluginEventSystem.
194
+ // Then we can remove this special list.
195
+ domEventName === 'scroll' ;
196
+ }
192
197
193
198
accumulateSinglePhaseListeners (
194
199
targetInst ,
0 commit comments