Skip to content

Commit d802ac1

Browse files
authored
fix: make social cards clickable and remove z-index trickery (#1535)
1 parent ec6af7b commit d802ac1

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

app/components/CallToAction.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ const socialLinks = computed(() => [
2525
ctaKey: $t('about.get_involved.follow.cta'),
2626
},
2727
])
28+
29+
function handleCardClick(event: MouseEvent) {
30+
if ((event.target as HTMLElement).closest(':any-link')) return
31+
if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return
32+
33+
const selection = window.getSelection()
34+
if (selection && selection.type === 'Range') return
35+
36+
const card = event.currentTarget as HTMLElement
37+
const link = card.querySelector('a')
38+
link?.click()
39+
}
2840
</script>
2941

3042
<template>
@@ -37,15 +49,16 @@ const socialLinks = computed(() => [
3749
<div
3850
v-for="link in socialLinks"
3951
:key="link.id"
40-
class="group relative grid gap-3 p-4 rounded-lg bg-bg-subtle hover:bg-bg-elevated border border-border hover:border-border-hover transition-all duration-200 sm:grid-rows-subgrid sm:row-span-3 focus-within:ring-2 focus-within:ring-accent/50"
52+
@click="handleCardClick"
53+
class="cursor-pointer group relative grid gap-3 p-4 rounded-lg bg-bg-subtle hover:bg-bg-elevated border border-border hover:border-border-hover transition-all duration-200 sm:grid-rows-subgrid sm:row-span-3 focus-within:ring-2 focus-within:ring-accent/50"
4154
>
42-
<h3 class="z-1 flex gap-2">
55+
<h3 class="flex gap-2">
4356
<span :class="link.icon" class="shrink-0 mt-1 w-5 h-5 text-fg" aria-hidden="true" />
4457
<span class="font-medium text-fg">
4558
{{ link.titleKey }}
4659
</span>
4760
</h3>
48-
<p class="z-1 text-sm text-fg-muted leading-relaxed">
61+
<p class="text-sm text-fg-muted leading-relaxed">
4962
{{ link.descriptionKey }}
5063
</p>
5164
<a
@@ -56,7 +69,6 @@ const socialLinks = computed(() => [
5669
>
5770
{{ link.ctaKey }}
5871
<span class="i-lucide:arrow-right rtl-flip w-3 h-3" aria-hidden="true" />
59-
<span class="absolute z-0 inset-0" aria-hidden="true" />
6072
</a>
6173
</div>
6274
</div>

0 commit comments

Comments
 (0)