Skip to content

Fix linkDecorationHandler targeting #1002

Description

@philipherrmann

What

We observed that the 3.0.3 snowplow js tracker is decorating the wrong elements.

How to reconstruct

In a situation like this

    <a href="abc">
        <img src.../>
    </a>

the sp.js tracker would add an event listener to the a-Tag, if abc matches the crossDomainLinker criterion. Now if the image is clicked. The event listener receives and event e and decorates a.target.href, but it should decorate a.currentTarget.href. Thus, the links default action will follow an undecorated link. The responsible code is here:

let elt = evt.target as HTMLAnchorElement | HTMLAreaElement | null;

In earlier versions of the sp.js tracker the event listener ignored the incoming event, i.e. like () => { decoration; }, and then decorate the href of this, which actually equals e.currentTarget.

Newer versions of the sp.js tracker are also impacted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions