fix(docs): stop tag click propagation to prevent parent anchor navigation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-20 00:23:48 +02:00
parent 3707d34c62
commit 80e10e1755

View File

@@ -26,8 +26,8 @@ const hasMore = $derived(item.contributors.length >= 4);
function tagClass(matched: boolean): string { function tagClass(matched: boolean): string {
return matched return matched
? 'inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-bold tracking-widest uppercase bg-primary text-primary-fg transition-colors' ? 'inline-flex items-center gap-1 rounded px-2 py-1.5 text-xs font-bold tracking-widest uppercase bg-primary text-primary-fg transition-colors'
: 'inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-bold tracking-widest uppercase bg-muted text-ink hover:bg-primary hover:text-primary-fg transition-colors'; : 'inline-flex items-center gap-1 rounded px-2 py-1.5 text-xs font-bold tracking-widest uppercase bg-muted text-ink hover:bg-primary hover:text-primary-fg transition-colors';
} }
</script> </script>
@@ -38,7 +38,7 @@ function tagClass(matched: boolean): string {
<div class="flex-1 sm:border-r sm:border-line sm:pr-5"> <div class="flex-1 sm:border-r sm:border-line sm:pr-5">
<!-- Title --> <!-- Title -->
<h3 class="mb-1 font-serif text-xl font-medium text-ink group-hover:underline"> <h3 class="mb-1 font-serif text-xl font-medium text-ink group-hover:underline">
{#each titleSegments as seg (seg.text + seg.highlight)} {#each titleSegments as seg, i (i)}
{#if seg.highlight} {#if seg.highlight}
<mark <mark
class="bg-transparent text-inherit underline decoration-brand-navy decoration-2 underline-offset-2" class="bg-transparent text-inherit underline decoration-brand-navy decoration-2 underline-offset-2"
@@ -53,7 +53,7 @@ function tagClass(matched: boolean): string {
<!-- Snippet --> <!-- Snippet -->
{#if snippetSegments} {#if snippetSegments}
<p class="mb-2 line-clamp-2 font-sans text-sm text-ink-2 italic"> <p class="mb-2 line-clamp-2 font-sans text-sm text-ink-2 italic">
{#each snippetSegments as seg (seg.text + seg.highlight)} {#each snippetSegments as seg, i (i)}
{#if seg.highlight} {#if seg.highlight}
<mark <mark
class="bg-transparent text-inherit underline decoration-brand-navy decoration-2 underline-offset-2" class="bg-transparent text-inherit underline decoration-brand-navy decoration-2 underline-offset-2"
@@ -114,7 +114,7 @@ function tagClass(matched: boolean): string {
<button <button
type="button" type="button"
class={tagClass(matchedTagIds.has(tag.id))} class={tagClass(matchedTagIds.has(tag.id))}
onclick={() => goto('/documents?tag=' + encodeURIComponent(tag.name))} onclick={(e) => { e.stopPropagation(); goto('/documents?tag=' + encodeURIComponent(tag.name)); }}
> >
{#if tag.color} {#if tag.color}
<span class="h-1.5 w-1.5 rounded-full" style="background-color: {tag.color};" <span class="h-1.5 w-1.5 rounded-full" style="background-color: {tag.color};"