Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/react-dom/src/events/DOMEventResponderSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const eventResponderContext: ReactDOMResponderContext = {
return false;
},
isTargetWithinNode(
childTarget: null | Element | Document,
childTarget: Element | Document,
parentTarget: Element | Document,
): boolean {
validateResponderContext();
Expand Down
22 changes: 9 additions & 13 deletions packages/react-events/src/dom/Tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,22 +321,17 @@ function getHitTarget(
context: ReactDOMResponderContext,
state: TapState,
): null | Element | Document {
if (hasPointerEvents) {
return event.target;
} else {
if (event.pointerType === 'touch') {
const doc = context.getActiveDocument();
const nativeEvent: any = event.nativeEvent;
const touch = getTouchById(nativeEvent, state.activePointerId);
if (touch != null) {
return doc.elementFromPoint(touch.clientX, touch.clientY);
} else {
return null;
}
if (!hasPointerEvents && event.pointerType === 'touch') {
const doc = context.getActiveDocument();
const nativeEvent: any = event.nativeEvent;
const touch = getTouchById(nativeEvent, state.activePointerId);
if (touch != null) {
return doc.elementFromPoint(touch.clientX, touch.clientY);
} else {
return event.target;
return null;
}
}
return event.target;
}

function isActivePointer(
Expand Down Expand Up @@ -617,6 +612,7 @@ const responderImpl = {
case 'scroll': {
if (
state.isActive &&
state.responderTarget != null &&
// We ignore incoming scroll events when using mouse events
state.pointerType !== 'mouse' &&
// If the scroll target is the document or if the pointer target
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/ReactDOMTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export type ReactDOMResponderContext = {
eventPriority: EventPriority,
) => void,
isTargetWithinNode: (
childTarget: null | Element | Document,
childTarget: Element | Document,
parentTarget: Element | Document,
) => boolean,
isTargetWithinResponder: (null | Element | Document) => boolean,
Expand Down