Skip to content

Commit

Permalink
fix: native cancel event should only fired on AT_TARGET
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-lx committed Jan 9, 2024
1 parent 6dce942 commit a04f48a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,13 @@ function extractEvents(
nativeEvent,
nativeEventTarget,
);
const isBubblingPhase = event.eventPhase === 3;
// should not fire native cancel event on bubblingPhase
const isAtTarget = event.eventPhase === 2;
// native cancel event should only fired on AT_TARGET
// https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase
if (
domEventName === 'cancel' &&
(eventSystemFlags & IS_NON_DELEGATED) !== 0 &&
isBubblingPhase
!isAtTarget
) {
return;
}
Expand Down

0 comments on commit a04f48a

Please sign in to comment.