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(checkout): CHECKOUT-7125 Adding additional aria attributes to coupon code and gift certificate buttons on the cart page #2391

Merged
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
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Corrected typo with the word default previously deafault in config.json [#2410](https://github.com/bigcommerce/cornerstone/pull/2410)
- Adding autocomplete to common input fields [2397](https://github.com/bigcommerce/cornerstone/pull/2397)
- Use triple sash on customer's company name to prevent escaping ampersands [#2399](https://github.com/bigcommerce/cornerstone/pull/2399)
- Adding aria attributes to cart page coupon code and gift cert buttons [#2391](https://github.com/bigcommerce/cornerstone/pull/2391)

## 6.12.0 (07-06-2023)
- sync package lock file [#2373](https://github.com/bigcommerce/cornerstone/pull/2373)
Expand Down
4 changes: 4 additions & 0 deletions assets/js/theme/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ export default class Cart extends PageManager {

$(event.currentTarget).hide();
$couponContainer.show();
$couponContainer.attr('aria-hidden', false);
$('.coupon-code-cancel').show();
$codeInput.trigger('focus');
});
Expand All @@ -301,6 +302,7 @@ export default class Cart extends PageManager {
event.preventDefault();

$couponContainer.hide();
$couponContainer.attr('aria-hidden', true);
$('.coupon-code-cancel').hide();
$('.coupon-code-add').show();
});
Expand Down Expand Up @@ -334,12 +336,14 @@ export default class Cart extends PageManager {
event.preventDefault();
$(event.currentTarget).toggle();
$certContainer.toggle();
$certContainer.attr('aria-hidden', false);
$('.gift-certificate-cancel').toggle();
});

$('.gift-certificate-cancel').on('click', event => {
event.preventDefault();
$certContainer.toggle();
$certContainer.attr('aria-hidden', true);
$('.gift-certificate-add').toggle();
$('.gift-certificate-cancel').toggle();
});
Expand Down
2 changes: 2 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"remove_item": "Remove {name} from cart",
"confirm_delete": "Are you sure you want to delete this item?",
"coupons": {
"apply_coupon": "Apply coupon",
"empty_error": "Please enter your coupon code.",
"cancel": "Cancel",
"add_code": "Add code",
Expand All @@ -89,6 +90,7 @@
"remove": "Remove"
},
"gift_certificates": {
"apply_gift_certificate": "Apply gift certificate",
"change_gift_certificate": "Change {certificate_name}",
"add_cert_code": "Add Certificate",
"gift_certificate": "Gift Certificate",
Expand Down
4 changes: 2 additions & 2 deletions templates/components/cart/coupon-input.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<button class="coupon-code-cancel" style="display: none;">{{lang 'cart.coupons.cancel'}}</button>
</div>

<div class="cart-form coupon-code" style="display: none;">
<div class="cart-form coupon-code" aria-hidden="true" style="display: none;">
<form class="form form--hiddenLabels coupon-form" method="post" action="{{urls.cart}}">
<label class="form-label" for="couponcode">{{lang 'cart.coupons.coupon_code'}}</label>
<input class="form-input" data-error="{{lang 'cart.coupons.empty_error'}}" id="couponcode" type="text" name="couponcode" value="" placeholder="{{lang 'cart.coupons.coupon_code'}}">
<input class="button button--primary button--small" type="submit" value="{{lang 'cart.coupons.button'}}">
<input class="button button--primary button--small" type="submit" aria-label="{{land 'cart.coupons.apply_coupon'}}" value="{{lang 'cart.coupons.button'}}">
<input type="hidden" name="action" value="applycoupon">
</form>
</div>
4 changes: 2 additions & 2 deletions templates/components/cart/gift-certificate-input.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<button class="gift-certificate-cancel" style="display: none;">{{lang 'cart.coupons.cancel'}}</button>
</div>

<div class="cart-form gift-certificate-code" style="display: none;">
<div class="cart-form gift-certificate-code" aria-hidden="true" style="display: none;">
<form class="form form--hiddenLabels cart-gift-certificate-form" method="post" action="{{urls.cart}}">
<label class="form-label" for="certcode">{{lang 'cart.gift_certificates.cert_code'}}</label>
<input class="form-input" id="certcode" type="text" name="certcode" value="" placeholder="{{lang 'cart.gift_certificates.add_cert_code'}}">
<input class="button button--primary button--small" type="submit" value="{{lang 'cart.coupons.button'}}">
<input class="button button--primary button--small" aria-label="{{lang 'cart.gift_certificates.apply_gift_certificate'}}" type="submit" value="{{lang 'cart.coupons.button'}}">
<input type="hidden" name="action" value="applycoupon">
</form>
</div>
Loading