Click event target gives element or it's child, not parent element

use event.currentTarget which points to the element that you attached the listener. It does not change as the event bubbles

https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget


Alternative solution with CSS:

a * {
    pointer-events: none;
}

The element is never the target of pointer events; however, pointer events may target its descendant elements if those descendants have pointer-events set to some other value. In these circumstances, pointer events will trigger event listeners on this parent element as appropriate on their way to/from the descendant during the event capture/bubble phases.

Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events#Values