Skip to content

Commit ad9bc4f

Browse files
Katie Petersonkatiepeterso
authored andcommitted
add an aria label for product quantity
1 parent 2d5c529 commit ad9bc4f

File tree

3 files changed

+29
-20
lines changed

3 files changed

+29
-20
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: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@
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' -%}
179-
<span
180-
>(
181-
{{- 'products.product.quantity.in_cart_html' | t: quantity: cart_qty -}}
182-
)</span
183-
>
183+
<span> ({{ cart_qty }} in cart)</span>
184184
</span>
185185
</label>
186186
<div class="price-per-item__container">
@@ -198,6 +198,7 @@
198198
type="number"
199199
name="quantity"
200200
id="Quantity-{{ section.id }}"
201+
aria-label="{% if cart_qty > 0 %}{{ 'products.product.quantity.in_cart_aria_label' | t: quantity: cart_qty }}{% else %}{{ 'products.product.quantity.label' | t }}{% endif %}"
201202
data-cart-quantity="{{ cart_qty }}"
202203
data-min="{{ product.selected_or_first_available_variant.quantity_rule.min }}"
203204
min="{{ product.selected_or_first_available_variant.quantity_rule.min }}"
@@ -289,7 +290,10 @@
289290
</dt>
290291
<dd>
291292
<span class="price-per-item--current">
292-
{{- 'products.product.volume_pricing.price_at_each_html' | t: price: variant_price -}}
293+
{{-
294+
'products.product.volume_pricing.price_at_each_html'
295+
| t: price: variant_price
296+
-}}
293297
</span>
294298
</dd>
295299
</dl>

sections/main-product.liquid

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,14 @@
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' -%}
246-
<span
247-
>(
248-
{{- 'products.product.quantity.in_cart_html' | t: quantity: cart_qty -}}
249-
)</span
250-
>
250+
<span> ({{ cart_qty }} in cart)</span>
251251
</span>
252252
</label>
253253
<div class="price-per-item__container">
@@ -356,7 +356,10 @@
356356
</dt>
357357
<dd>
358358
<span class="price-per-item--current">
359-
{{- 'products.product.volume_pricing.price_at_each_html' | t: price: variant_price -}}
359+
{{-
360+
'products.product.volume_pricing.price_at_each_html'
361+
| t: price: variant_price
362+
-}}
360363
</span>
361364
</dd>
362365
</dl>
@@ -1674,7 +1677,7 @@
16741677
{
16751678
"type": "header",
16761679
"content": "t:sections.main-product.blocks.icon_with_text.settings.pairing_2.label"
1677-
},
1680+
},
16781681
{
16791682
"type": "select",
16801683
"id": "icon_2",
@@ -1874,7 +1877,7 @@
18741877
{
18751878
"type": "header",
18761879
"content": "t:sections.main-product.blocks.icon_with_text.settings.pairing_3.label"
1877-
},
1880+
},
18781881
{
18791882
"type": "select",
18801883
"id": "icon_3",
@@ -2176,7 +2179,7 @@
21762179
],
21772180
"default": "hide",
21782181
"label": "t:sections.main-product.settings.mobile_thumbnails.label"
2179-
},
2182+
},
21802183
{
21812184
"type": "select",
21822185
"id": "media_position",
@@ -2252,3 +2255,4 @@
22522255
]
22532256
}
22542257
{% endschema %}
2258+

0 commit comments

Comments
 (0)