Skip to content

Commit

Permalink
Let Ctrl + Click use the default browser behaviour
Browse files Browse the repository at this point in the history
This avoids issues like Ctrl + Click overriding the current tab instead of opening a new one. Ctrl + Click now behaves like middle-mouse-click which is correct AFAIK.
  • Loading branch information
Joelius300 committed Nov 20, 2021
1 parent 9a31759 commit 4d289d2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ export default function Plausible(
}
) => {
function trackClick(this: HTMLAnchorElement, event: MouseEvent) {
if (event.ctrlKey) return; // Don't send event on Ctrl + Click, should behave like middle-mouse-click.

trackEvent('Outbound Link: Click', { props: { url: this.href } });

/* istanbul ignore next */
Expand Down

0 comments on commit 4d289d2

Please sign in to comment.