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-132 Visually hidden cart link read by screen… #1770

Merged
merged 2 commits into from
Aug 26, 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
- 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