Skip to content

Commit

Permalink
fix(storefront): BCTHEME-132 Visually hidden cart link read by screen…
Browse files Browse the repository at this point in the history
… reader
  • Loading branch information
BC-tymurbiedukhin committed Aug 6, 2020
1 parent 353c9c8 commit a43f606
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Visually hidden cart link read by screen reader. [#1770](https://github.com/bigcommerce/cornerstone/pull/1770)

## 4.9.0 (08-05-2020)

Expand Down
5 changes: 5 additions & 0 deletions assets/js/theme/global/cart-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export default function (secureBaseUrl, cartId) {
const $body = $('body');

$body.on('cart-quantity-update', (event, quantity) => {
if (!quantity) {
$cart.addClass('navUser-item--cart__hidden-s');
} else {
$cart.removeClass('navUser-item--cart__hidden-s');
}
$('.cart-quantity')
.text(quantity)
.toggleClass('countPill--positive', quantity > 0);
Expand Down
7 changes: 7 additions & 0 deletions assets/scss/components/stencil/navUser/_navUser.scss
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@
.navUser-item--cart {
display: block;

// removing cart link for small screens when quantity is 0
&__hidden-s {
@media (max-width: $screen-small) {
display: none;
}
}

.navUser-action {
color: stencilColor("navUser-color");

Expand Down

0 comments on commit a43f606

Please sign in to comment.