@@ -342,6 +342,21 @@ export function listenToNativeEvent(
342342 if ( domEventName === 'selectionchange' ) {
343343 target = ( rootContainerElement : any ) . ownerDocument ;
344344 }
345+ if ( isPassiveListener === undefined ) {
346+ // Browsers introduced an intervention, making these events
347+ // passive by default on document. React doesn't bind them
348+ // to document anymore, but changing this now would undo
349+ // the performance wins from the change. So we emulate
350+ // the existing behavior manually on the roots now.
351+ // https://github.com/facebook/react/issues/19651
352+ if (
353+ domEventName === 'touchstart' ||
354+ domEventName === 'touchmove' ||
355+ domEventName === 'wheel'
356+ ) {
357+ isPassiveListener = true ;
358+ }
359+ }
345360 // If the event can be delegated (or is capture phase), we can
346361 // register it to the root container. Otherwise, we should
347362 // register the event to the target element and mark it as
@@ -506,7 +521,7 @@ function addTrappedEventListener(
506521 } ;
507522 }
508523 if ( isCapturePhaseListener ) {
509- if ( enableCreateEventHandleAPI && isPassiveListener !== undefined ) {
524+ if ( isPassiveListener !== undefined ) {
510525 unsubscribeListener = addEventCaptureListenerWithPassiveFlag (
511526 targetContainer ,
512527 domEventName ,
@@ -521,7 +536,7 @@ function addTrappedEventListener(
521536 ) ;
522537 }
523538 } else {
524- if ( enableCreateEventHandleAPI && isPassiveListener !== undefined ) {
539+ if ( isPassiveListener !== undefined ) {
525540 unsubscribeListener = addEventBubbleListenerWithPassiveFlag (
526541 targetContainer ,
527542 domEventName ,
0 commit comments