From 4d289d2a1899fb7b7d69f6ac6bff9e77952bb6b5 Mon Sep 17 00:00:00 2001 From: Joel Liechti Date: Sat, 20 Nov 2021 12:00:29 +0100 Subject: [PATCH] Let Ctrl + Click use the default browser behaviour 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. --- src/lib/tracker.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/tracker.ts b/src/lib/tracker.ts index c538926..2780a8e 100644 --- a/src/lib/tracker.ts +++ b/src/lib/tracker.ts @@ -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 */