File tree Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ const eventResponderContext: ReactDOMResponderContext = {
158158 return false ;
159159 } ,
160160 isTargetWithinNode (
161- childTarget : null | Element | Document ,
161+ childTarget : Element | Document ,
162162 parentTarget : Element | Document ,
163163 ) : boolean {
164164 validateResponderContext ( ) ;
Original file line number Diff line number Diff line change @@ -321,22 +321,17 @@ function getHitTarget(
321321 context : ReactDOMResponderContext ,
322322 state : TapState ,
323323) : null | Element | Document {
324- if ( hasPointerEvents ) {
325- return event . target ;
326- } else {
327- if ( event . pointerType === 'touch' ) {
328- const doc = context . getActiveDocument ( ) ;
329- const nativeEvent : any = event . nativeEvent ;
330- const touch = getTouchById ( nativeEvent , state . activePointerId ) ;
331- if ( touch != null ) {
332- return doc . elementFromPoint ( touch . clientX , touch . clientY ) ;
333- } else {
334- return null ;
335- }
324+ if ( ! hasPointerEvents && event . pointerType === 'touch' ) {
325+ const doc = context . getActiveDocument ( ) ;
326+ const nativeEvent : any = event . nativeEvent ;
327+ const touch = getTouchById ( nativeEvent , state . activePointerId ) ;
328+ if ( touch != null ) {
329+ return doc . elementFromPoint ( touch . clientX , touch . clientY ) ;
336330 } else {
337- return event . target ;
331+ return null ;
338332 }
339333 }
334+ return event . target ;
340335}
341336
342337function isActivePointer (
@@ -617,6 +612,7 @@ const responderImpl = {
617612 case 'scroll' : {
618613 if (
619614 state . isActive &&
615+ state . responderTarget != null &&
620616 // We ignore incoming scroll events when using mouse events
621617 state . pointerType !== 'mouse' &&
622618 // If the scroll target is the document or if the pointer target
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ export type ReactDOMResponderContext = {
5555 eventPriority : EventPriority ,
5656 ) => void ,
5757 isTargetWithinNode : (
58- childTarget : null | Element | Document ,
58+ childTarget : Element | Document ,
5959 parentTarget : Element | Document ,
6060 ) => boolean,
6161 isTargetWithinResponder : ( null | Element | Document ) => boolean ,
You can’t perform that action at this time.
0 commit comments