Skip to content

Commit c93a3fb

Browse files
committed
add an aria label for product quantity
1 parent 2d5c529 commit c93a3fb

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

locales/en.default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
"min_of": "Min {{ quantity }}",
141141
"max_of": "Max {{ quantity }}",
142142
"in_cart_html": "<span class=\"quantity-cart\">{{ quantity }}</span> in cart",
143+
"in_cart_aria_label": "Quantity ({{ quantity }} in cart)",
143144
"note": "View quantity rules"
144145
},
145146
"volume_pricing": {
@@ -526,4 +527,4 @@
526527
"send_on_label": "Send on (optional)"
527528
}
528529
}
529-
}
530+
}

sections/featured-product.liquid

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,12 @@
173173
-%}
174174
{% # theme-check-enable %}
175175
<label class="quantity__label form__label" for="Quantity-{{ section.id }}">
176-
{{ 'products.product.quantity.label' | t }}
177-
<span class="quantity__rules-cart{% if cart_qty == 0 %} hidden{% endif %}">
176+
{% if cart_qty > 0 %}
177+
{{ 'products.product.quantity.in_cart_aria_label' | t: quantity: cart_qty }}
178+
{% else %}
179+
{{ 'products.product.quantity.label' | t }}
180+
{% endif %}
181+
<span class="quantity__rules-cart hidden" aria-hidden="true">
178182
{%- render 'loading-spinner' -%}
179183
<span
180184
>(
@@ -289,7 +293,10 @@
289293
</dt>
290294
<dd>
291295
<span class="price-per-item--current">
292-
{{- 'products.product.volume_pricing.price_at_each_html' | t: price: variant_price -}}
296+
{{-
297+
'products.product.volume_pricing.price_at_each_html'
298+
| t: price: variant_price
299+
-}}
293300
</span>
294301
</dd>
295302
</dl>

sections/main-product.liquid

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,12 @@
240240
-%}
241241
{% # theme-check-enable %}
242242
<label class="quantity__label form__label" for="Quantity-{{ section.id }}">
243-
{{ 'products.product.quantity.label' | t }}
244-
<span class="quantity__rules-cart{% if cart_qty == 0 %} hidden{% endif %}">
243+
{% if cart_qty > 0 %}
244+
{{ 'products.product.quantity.in_cart_aria_label' | t: quantity: cart_qty }}
245+
{% else %}
246+
{{ 'products.product.quantity.label' | t }}
247+
{% endif %}
248+
<span class="quantity__rules-cart hidden" aria-hidden="true">
245249
{%- render 'loading-spinner' -%}
246250
<span
247251
>(
@@ -356,7 +360,10 @@
356360
</dt>
357361
<dd>
358362
<span class="price-per-item--current">
359-
{{- 'products.product.volume_pricing.price_at_each_html' | t: price: variant_price -}}
363+
{{-
364+
'products.product.volume_pricing.price_at_each_html'
365+
| t: price: variant_price
366+
-}}
360367
</span>
361368
</dd>
362369
</dl>
@@ -1674,7 +1681,7 @@
16741681
{
16751682
"type": "header",
16761683
"content": "t:sections.main-product.blocks.icon_with_text.settings.pairing_2.label"
1677-
},
1684+
},
16781685
{
16791686
"type": "select",
16801687
"id": "icon_2",
@@ -1874,7 +1881,7 @@
18741881
{
18751882
"type": "header",
18761883
"content": "t:sections.main-product.blocks.icon_with_text.settings.pairing_3.label"
1877-
},
1884+
},
18781885
{
18791886
"type": "select",
18801887
"id": "icon_3",
@@ -2176,7 +2183,7 @@
21762183
],
21772184
"default": "hide",
21782185
"label": "t:sections.main-product.settings.mobile_thumbnails.label"
2179-
},
2186+
},
21802187
{
21812188
"type": "select",
21822189
"id": "media_position",

0 commit comments

Comments
 (0)