From 9afcfff28cd4c696c9e530c5243842b2dbd4c1b6 Mon Sep 17 00:00:00 2001 From: Ole Gammelgaard Poulsen Date: Sat, 22 Feb 2025 21:03:46 +0100 Subject: [PATCH 1/2] Fixes issue where clicking a table row link with openInNewTab=true did not actually open the link in a new tab --- .../src/lib/unsorted/viz/table/TableRow.svelte | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/ui/core-components/src/lib/unsorted/viz/table/TableRow.svelte b/packages/ui/core-components/src/lib/unsorted/viz/table/TableRow.svelte index 6fc5b1b65e..aa5a55dd15 100644 --- a/packages/ui/core-components/src/lib/unsorted/viz/table/TableRow.svelte +++ b/packages/ui/core-components/src/lib/unsorted/viz/table/TableRow.svelte @@ -41,10 +41,16 @@ await preloadData(url); }; - const navigateToLink = async (row) => { + const navigateToLink = async (row, event) => { if (!link || !row[link]) return; const url = row[link]; + // Don't handle the click if it's on a link element that should open in new tab + const target = event?.target?.closest('a'); + if (target?.getAttribute('target') === '_blank') { + return; + } + if (isUrlExternal(url)) { window.location = addBasePath(url); return; @@ -63,7 +69,7 @@ class:hover:bg-base-200={link && row[link]} on:mouseover={() => preloadLink(row)} on:focus={() => preloadLink(row)} - on:click={() => navigateToLink(row)} + on:click={(event) => navigateToLink(row, event)} class={rowLines ? 'border-b border-base-content-muted/20' : ''} > {#if rowNumbers && groupType !== 'section'} From b68cba4c884d2c62293ca13fdd41bb84344bc480 Mon Sep 17 00:00:00 2001 From: Archie Wood <58074498+archiewood@users.noreply.github.com> Date: Mon, 24 Feb 2025 09:20:10 -0500 Subject: [PATCH 2/2] changeset --- .changeset/plenty-rings-nail.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/plenty-rings-nail.md diff --git a/.changeset/plenty-rings-nail.md b/.changeset/plenty-rings-nail.md new file mode 100644 index 0000000000..051b514c37 --- /dev/null +++ b/.changeset/plenty-rings-nail.md @@ -0,0 +1,5 @@ +--- +'@evidence-dev/core-components': patch +--- + +Fixes issue where clicking a table row link with openInNewTab=true did not actually open the link in a new tab