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

fix(storefront): BCTHEME-369 fix announcement on adding to cart by screen reader #1950

Merged
merged 2 commits into from
Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
- Fixed announcement for product on adding to cart. [#1950](https://github.com/bigcommerce/cornerstone/pull/1950)
- Fixed non-text contrast on add to cart modal according to WCAG AA standard. [#1946](https://github.com/bigcommerce/cornerstone/pull/1946)
- Fixed announcement of reCAPTCHA hidden content by screen reader. [#1943](https://github.com/bigcommerce/cornerstone/pull/1943)
- Carousel buttons do not receive focus. [#1937](https://github.com/bigcommerce/cornerstone/pull/1937)
Expand Down
5 changes: 5 additions & 0 deletions assets/js/theme/common/product-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ export default class ProductDetails extends ProductDetailsBase {
this.redirectTo(response.data.cart_item.cart_url || this.context.urls.cart);
}
});

$addToCartBtn.next().attr({
role: 'status',
'aria-live': 'polite',
});
}

/**
Expand Down
12 changes: 9 additions & 3 deletions templates/components/products/add-to-cart.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@
<p class="alertBox-column alertBox-message"></p>
</div>
{{#or customer (if theme_settings.restrict_to_login '!==' true)}}
<div class="form-action" role="status" aria-live="polite">
<input id="form-action-addToCart" data-wait-message="{{lang 'products.adding_to_cart'}}" class="button button--primary" type="submit"
value="{{#if product.pre_order}}{{lang 'products.pre_order'}}{{else}}{{lang 'products.add_to_cart'}}{{/if}}">
<div class="form-action">
<input
id="form-action-addToCart"
data-wait-message="{{lang 'products.adding_to_cart'}}"
class="button button--primary"
type="submit"
value="{{#if product.pre_order}}{{lang 'products.pre_order'}}{{else}}{{lang 'products.add_to_cart'}}{{/if}}"
>
<span class="product-status-message aria-description--hidden">{{lang 'products.adding_to_cart'}} {{lang 'category.add_cart_announcement'}}</span>
</div>
{{/or}}