Skip to content

Commit 517d021

Browse files
fix(a11y): make span metrics badges focusable to render tooltip content (#877)
Co-authored-by: Daniel Roe <daniel@roe.dev>
1 parent 971dbea commit 517d021

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/components/Package/MetricsBadges.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const typesHref = computed(() => {
5959
<component
6060
:is="typesHref ? NuxtLink : 'span'"
6161
:to="typesHref"
62+
:tabindex="!typesHref ? 0 : undefined"
6263
class="inline-flex items-center gap-1 px-1.5 py-0.5 font-mono text-xs rounded transition-colors duration-200"
6364
:class="[
6465
hasTypes
@@ -83,6 +84,7 @@ const typesHref = computed(() => {
8384
<li>
8485
<TooltipApp :text="hasEsm ? $t('package.metrics.esm') : $t('package.metrics.no_esm')">
8586
<span
87+
tabindex="0"
8688
class="inline-flex items-center gap-1 px-1.5 py-0.5 font-mono text-xs rounded transition-colors duration-200"
8789
:class="
8890
hasEsm
@@ -104,6 +106,7 @@ const typesHref = computed(() => {
104106
<li v-if="hasCjs">
105107
<TooltipApp :text="$t('package.metrics.cjs')">
106108
<span
109+
tabindex="0"
107110
class="inline-flex items-center gap-1 px-1.5 py-0.5 font-mono text-xs text-fg-muted bg-bg-muted border border-border rounded transition-colors duration-200"
108111
>
109112
<span class="i-carbon-checkmark w-3 h-3" aria-hidden="true" />

0 commit comments

Comments
 (0)