Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(storefront): BCTHEME-290 add aria label with price for product list item #1878

Merged
merged 2 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Add aria label with price to Product List Item. [#1878](https://github.com/bigcommerce/cornerstone/pull/1878)
- Unified browsers list that we support. [#1836](https://github.com/bigcommerce/cornerstone/pull/1836)
- Bump stencil utils and update hooks to account for refactor to drop Jquery in stencil utils [#1821](https://github.com/bigcommerce/cornerstone/pull/1821)

Expand Down
9 changes: 8 additions & 1 deletion templates/components/products/list-item.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@
<p class="listItem-brand">{{brand.name}}</p>
{{/if}}
<h4 class="listItem-title">
<a href="{{url}}" {{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}}>{{name}}</a>
<a href="{{url}}"
aria-label="{{name}},{{> components/products/product-aria-label}}"
{{#if settings.data_tag_enabled}}
data-event-type="product-click"
{{/if}}
>
{{name}}
</a>
</h4>
{{#if summary}}
<p>{{{summary}}}</p>
Expand Down
23 changes: 23 additions & 0 deletions templates/components/products/product-aria-label.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{#and price.price_range (if theme_settings.price_ranges '==' true)}}
{{#and price.price_range.min.with_tax price.price_range.max.with_tax}}
{{lang 'category.shop_by_price_range_aria' from=price.price_range.min.with_tax.formatted to=price.price_range.max.with_tax.formatted}}
{{else}}
{{lang 'category.shop_by_price_range_aria' from=price.price_range.min.without_tax.formatted to=price.price_range.max.without_tax.formatted}}
{{/and}}
{{else}}
{{#if price.with_tax}}
{{#if price.non_sale_price_with_tax}}
{{theme_settings.pdp-non-sale-price-label}}{{price.non_sale_price_with_tax.formatted}},
{{theme_settings.pdp-sale-price-label}}{{price.with_tax.formatted}}
{{else}}
{{price.with_tax.formatted}}
{{/if}}
{{else}}
{{#if price.non_sale_price_without_tax}}
{{theme_settings.pdp-non-sale-price-label}}{{price.non_sale_price_without_tax.formatted}},
{{theme_settings.pdp-sale-price-label}}{{price.without_tax.formatted}}
{{else}}
{{price.without_tax.formatted}}
{{/if}}
{{/if}}
{{/and}}