Skip to content

Commit 04ddbc7

Browse files
committed
chore(template): a11y optimization
Signed-off-by: Frederik Bußmann <frederik@bussmann.io>
1 parent e567a2a commit 04ddbc7

8 files changed

Lines changed: 27 additions & 4 deletions

File tree

template/app/components/Logo.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const { data: logo } = await useStorefrontData('logo', `#graphql
2626
>
2727
<NuxtImg
2828
:src="logo?.url"
29-
:alt="logo?.altText || 'Nuxt Shopify'"
29+
:alt="logo?.altText || 'Nuxt Shopify Store Logo'"
3030
provider="shopify"
3131
class="h-5 w-auto hue-rotate-300"
3232
width="50"

template/app/components/cart/Choose.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const open = ref(false)
2424
variant="ghost"
2525
trailing-icon="i-lucide-shopping-bag"
2626
:label="$t('product.choose')"
27+
:aria-label="$t('product.choose')"
2728
:ui="{
2829
trailingIcon: 'size-5',
2930
label: [

template/app/components/cart/LineItem.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ watch(state, state => update(props.line.id, state.quantity))
2626

2727
<template>
2828
<UCard :ui="{ body: 'relative flex justify-between gap-8' }">
29-
<NuxtLink :to="to">
29+
<NuxtLink
30+
:to="to"
31+
:aria-label="`${$t('product.view')}: '${variant.product.title}'`"
32+
>
3033
<NuxtImg
3134
provider="shopify"
3235
:src="variant.image?.url"

template/app/components/cart/Modal.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ watch(() => route.path, () => open.value = false)
1717
icon="i-lucide-shopping-cart"
1818
variant="ghost"
1919
color="neutral"
20+
:label="$t('cart.open')"
21+
:ui="{
22+
label: 'sr-only',
23+
base: 'px-1.5 lg:px-2',
24+
}"
2025
/>
2126

2227
<ClientOnly>

template/app/components/product/Card.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,33 @@ const variant = ref(variants.value[0])
3737
arrows
3838
loop
3939
>
40-
<NuxtLink :to="url">
40+
<NuxtLink
41+
:to="url"
42+
:aria-label="`${$t('product.view')}: '${props.product.title}'`"
43+
>
4144
<ProductImage
4245
:image="item"
4346
:loading="index === 0 ? props.loading : 'lazy'"
47+
:title="`${props.product.title}${index !== 0 ? ` (${index})` : ''}`"
4448
/>
4549
</NuxtLink>
4650
</UCarousel>
4751

4852
<NuxtLink
4953
v-else
5054
:to="url"
55+
:aria-label="`${$t('product.view')}: '${props.product.title}'`"
5156
>
5257
<ProductImage
5358
:image="images?.[0] ?? undefined"
5459
:loading="props.loading"
60+
:title="props.product.title"
5561
/>
5662

5763
<ProductImage
5864
v-if="images?.[1]"
5965
:image="images[1]"
66+
:title="`${props.product.title} (1)`"
6067
class="hidden absolute inset-0 bg-default group-hover:block"
6168
/>
6269
</NuxtLink>

template/app/components/product/Gallery.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ watch(() => props.selectedVariant, () => carousel.value?.emblaApi?.scrollTo(0))
4545
<ProductImage
4646
:image="item"
4747
:loading="index === 0 ? 'eager' : 'lazy'"
48+
:title="`${props.product.title}${index !== 0 ? ` (${index})` : ''}`"
4849
/>
4950
</UCarousel>
5051

5152
<ProductImage
5253
v-else
5354
:image="sliderImages[0]"
55+
:title="props.product.title"
5456
class="mb-6 lg:mb-8"
5557
loading="eager"
5658
/>
@@ -60,9 +62,10 @@ watch(() => props.selectedVariant, () => carousel.value?.emblaApi?.scrollTo(0))
6062
class="hidden lg:grid grid-cols-12 gap-8 mb-6 lg:mb-8"
6163
>
6264
<ProductImage
63-
v-for="image in images"
65+
v-for="(image, index) in images"
6466
:key="image.url"
6567
:image="image ?? undefined"
68+
:title="`${props.product.title} Thumbnail ${index !== 0 ? ` (${index})` : ''}`"
6669
class="col-span-6"
6770
/>
6871
</div>

template/i18n/locales/de.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"empty": "Ihr Warenkorb ist leer.",
1010
"subtotal": "Summe",
1111
"checkout": "Zur Kasse",
12+
"open": "Warenkorb öffnen",
1213
"toast": {
1314
"add": "Artikel zum Warenkorb hinzugefügt.",
1415
"update": "Ihr Warenkorb wurde aktualisiert.",
@@ -44,6 +45,7 @@
4445
"product": {
4546
"add": "Hinzufügen",
4647
"choose": "Auswählen",
48+
"view": "Produkt ansehen",
4749
"recommendations": "Das könnte Ihnen auch gefallen"
4850
},
4951
"collection": {

template/i18n/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"empty": "Your cart is empty.",
1010
"subtotal": "Subtotal",
1111
"checkout": "Checkout",
12+
"open": "Open Cart",
1213
"toast": {
1314
"add": "Item added to cart.",
1415
"update": "Cart updated.",
@@ -44,6 +45,7 @@
4445
"product": {
4546
"add": "Add",
4647
"choose": "Choose",
48+
"view": "View product",
4749
"recommendations": "You may also like"
4850
},
4951
"collection": {

0 commit comments

Comments
 (0)