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-366 Error message on PLPs not announced by screen reader #1956

Merged
merged 2 commits into from
Jan 19, 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
- Error message on PLPs not announced by screen reader. [#1956](https://github.com/bigcommerce/cornerstone/pull/1956)
- Add Play/Pause button to carousel. [#1944](https://github.com/bigcommerce/cornerstone/pull/1944)
- Alt text not provided for ratings. [#1949](https://github.com/bigcommerce/cornerstone/pull/1949)
- Fixed announcement for product on adding to cart. [#1950](https://github.com/bigcommerce/cornerstone/pull/1950)
Expand Down
9 changes: 9 additions & 0 deletions assets/js/theme/category.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ export default class Category extends CatalogPage {
'aria-live': 'polite',
});
});

this.ariaNotifyNoProducts();
}

ariaNotifyNoProducts() {
const $noProductsMessage = $('[data-no-products-notification]');
if ($noProductsMessage.length) {
$noProductsMessage.focus();
}
}

initFacetedSearch() {
Expand Down
8 changes: 7 additions & 1 deletion templates/components/category/product-listing.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,11 @@

{{> components/common/paginator pagination.category}}
{{else}}
<span role="text" tabindex="0">{{lang 'categories.no_products'}}</span>
<p data-no-products-notification
role="alert"
aria-live="assertive"
tabindex="-1"
>
{{lang 'categories.no_products'}}
</p>
{{/if}}