From 2a440e1064bddc839df91dbe77fc27bb8bd15641 Mon Sep 17 00:00:00 2001 From: Tom Wilkinson Date: Thu, 30 May 2024 12:14:02 -0500 Subject: [PATCH] fix(core): Fix shouldPreventDefaultBeforeDispatching bug (#56188) When I copied this over in https://github.com/angular/angular/commit/caedd10597a6becfc1f1f0d98b06dc76d6b25a86 the parentheses moved around the A tag check and the CLICK type check, instead of around the CLICK and CLICKMOD check. PR Close #56188 --- packages/core/primitives/event-dispatch/src/dispatcher.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/primitives/event-dispatch/src/dispatcher.ts b/packages/core/primitives/event-dispatch/src/dispatcher.ts index f01eac2f626..82162793dc7 100644 --- a/packages/core/primitives/event-dispatch/src/dispatcher.ts +++ b/packages/core/primitives/event-dispatch/src/dispatcher.ts @@ -133,8 +133,9 @@ function shouldPreventDefaultBeforeDispatching( // a child of an anchor that has a jsaction attached. For that reason, we // need to check the actionElement rather than the targetElement. return ( - (actionElement.tagName === 'A' && eventInfoWrapper.getEventType() === EventType.CLICK) || - eventInfoWrapper.getEventType() === EventType.CLICKMOD + actionElement.tagName === 'A' && + (eventInfoWrapper.getEventType() === EventType.CLICK || + eventInfoWrapper.getEventType() === EventType.CLICKMOD) ); }