Skip to content

Commit 919a9ab

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

13 files changed

Lines changed: 37 additions & 10 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/collection/Products.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ watch(() => collection.value?.products.pageInfo, async () => await nextTick().th
128128
:key="product.id"
129129
:product="product"
130130
class="pb-14 border-b border-b-default"
131-
:loading="index === 0 ? 'eager' : 'lazy'"
131+
:loading="index < 3 ? 'eager' : 'lazy'"
132132
carousel
133133
/>
134134
</div>

template/app/components/collection/Slider.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const { data: products } = await useStorefrontData(key, `#graphql
8585
>
8686
<ProductCard
8787
:product="product"
88-
:loading="index === 0 ? props.loading : 'lazy'"
88+
:loading="index < 3 ? props.loading : 'lazy'"
8989
/>
9090
</UCarousel>
9191
</template>

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>

0 commit comments

Comments
 (0)