Skip to content

Commit 4536ba6

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

10 files changed

Lines changed: 34 additions & 7 deletions

File tree

template/app/components/Footer.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const items = computed<NavigationMenuItem[]>(() => [
9595

9696
<template #left>
9797
<p class="text-muted text-sm">
98-
Published under the MIT License.
98+
{{ $t('footer.message') }}
9999
</p>
100100
</template>
101101

@@ -120,6 +120,7 @@ const items = computed<NavigationMenuItem[]>(() => [
120120
:default-value="locale"
121121
icon="i-lucide-globe"
122122
variant="ghost"
123+
:aria-label="$t('footer.country')"
123124
@update:model-value="async value => switchLocale(value)"
124125
/>
125126
</template>

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/Add.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const addToCart = async () => {
2222
variant="ghost"
2323
trailing-icon="i-lucide-shopping-bag"
2424
:label="$t('product.add')"
25+
:aria-label="$t('product.choose')"
2526
:ui="{
2627
trailingIcon: 'size-5',
2728
label: [

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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
{
22
"footer": {
33
"message": "Veröffentlicht unter der MIT License.",
4-
"github": "Auf GitHub ansehen"
4+
"github": "Auf GitHub ansehen",
5+
"country": "Land und Währung auswählen"
56
},
67
"cart": {
78
"title": "Warenkorb",
89
"description": "Überprüfen Sie Ihre ausgewählten Artikel",
910
"empty": "Ihr Warenkorb ist leer.",
1011
"subtotal": "Summe",
1112
"checkout": "Zur Kasse",
13+
"open": "Warenkorb öffnen",
1214
"toast": {
1315
"add": "Artikel zum Warenkorb hinzugefügt.",
1416
"update": "Ihr Warenkorb wurde aktualisiert.",
@@ -44,6 +46,7 @@
4446
"product": {
4547
"add": "Hinzufügen",
4648
"choose": "Auswählen",
49+
"view": "Produkt ansehen",
4750
"recommendations": "Das könnte Ihnen auch gefallen"
4851
},
4952
"collection": {

template/i18n/locales/en.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
{
22
"footer": {
33
"message": "Published under the MIT License.",
4-
"github": "View on GitHub"
4+
"github": "View on GitHub",
5+
"country": "Select country and currency"
56
},
67
"cart": {
78
"title": "Cart",
89
"description": "Review your selected items",
910
"empty": "Your cart is empty.",
1011
"subtotal": "Subtotal",
1112
"checkout": "Checkout",
13+
"open": "Open Cart",
1214
"toast": {
1315
"add": "Item added to cart.",
1416
"update": "Cart updated.",
@@ -44,6 +46,7 @@
4446
"product": {
4547
"add": "Add",
4648
"choose": "Choose",
49+
"view": "View product",
4750
"recommendations": "You may also like"
4851
},
4952
"collection": {

0 commit comments

Comments
 (0)