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 = {
158
158
return false ;
159
159
} ,
160
160
isTargetWithinNode (
161
- childTarget : null | Element | Document ,
161
+ childTarget : Element | Document ,
162
162
parentTarget : Element | Document ,
163
163
) : boolean {
164
164
validateResponderContext ( ) ;
Original file line number Diff line number Diff line change @@ -321,22 +321,17 @@ function getHitTarget(
321
321
context : ReactDOMResponderContext ,
322
322
state : TapState ,
323
323
) : 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 ) ;
336
330
} else {
337
- return event . target ;
331
+ return null ;
338
332
}
339
333
}
334
+ return event . target ;
340
335
}
341
336
342
337
function isActivePointer (
@@ -617,6 +612,7 @@ const responderImpl = {
617
612
case 'scroll' : {
618
613
if (
619
614
state . isActive &&
615
+ state . responderTarget != null &&
620
616
// We ignore incoming scroll events when using mouse events
621
617
state . pointerType !== 'mouse' &&
622
618
// 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 = {
55
55
eventPriority : EventPriority ,
56
56
) => void ,
57
57
isTargetWithinNode : (
58
- childTarget : null | Element | Document ,
58
+ childTarget : Element | Document ,
59
59
parentTarget : Element | Document ,
60
60
) => boolean,
61
61
isTargetWithinResponder : ( null | Element | Document ) => boolean ,
You can’t perform that action at this time.
0 commit comments