Skip to content

Commit

Permalink
Fix edge-case anchor click behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
raffaele-abramini committed Sep 27, 2021
1 parent 626ad9b commit e94d183
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/getListenToLinksScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const getListenToLinksScript = (id: number) => `
const postMessage = (url) => parent.postMessage(validatedMessage(url), "${window.location.href}");
const listenToLinks = Array.from(document.querySelectorAll("a")).forEach(a => {
a.addEventListener("click", (e) => {
postMessage(e.target.href);
postMessage(a.getAttribute("href"));
return e.preventDefault();
});
});
Expand Down

0 comments on commit e94d183

Please sign in to comment.