Skip to content

Instantly share code, notes, and snippets.

@Polvista
Created June 5, 2017 12:32
Show Gist options
  • Save Polvista/b19054c705859cef8e38c70de4cf29f8 to your computer and use it in GitHub Desktop.
Save Polvista/b19054c705859cef8e38c70de4cf29f8 to your computer and use it in GitHub Desktop.
@shyamal890
Copy link

What is LinkUtils here?

@Plonq
Copy link

Plonq commented Oct 13, 2020

This won't work if you click an element inside an anchor though, e.g. <a href="..."><div>Click me</div></a>, because elm will be the <div> element. To solve this I used:

const nearestAnchor = event
  .composedPath()
  .find(element => (element as HTMLElement).tagName === "A");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment