Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix filter visual bug

dominik-zeglena24b65ab1d47
diff --git a/saleor/static/js/components/product-filters.js b/saleor/static/js/components/product-filters.js
index 4e58dc1567..e70119e720 100644
--- a/saleor/static/js/components/product-filters.js
+++ b/saleor/static/js/components/product-filters.js
@@ -6,12 +6,20 @@ export default $(document).ready((e) => {
let filterArrowDown = $('.product-filters__attributes').data('icon-down');
let filterArrowUp = $('.product-filters__attributes').data('icon-up');
+ ele.attr('aria-expanded', '');
+
$(this).find('.filter-label').on('click', () => {
- if (ele.css('display') == 'block') {
- ele.css('display', 'none');
+ if (ele.attr('aria-expanded') !== undefined) {
+ ele.removeAttr('aria-expanded').find('input[type="checkbox"], input[type="number"]').each((i, el) => {
+ if (!el.checked) {
+ $(el.parentNode.parentNode).addClass('d-none');
+ }
+ });
icon.find('img').attr('src', filterArrowDown);
} else {
- ele.css('display', 'block');
+ ele.attr('aria-expanded', '').find('input[type="checkbox"], input[type="number"]').each((i, el) => {
+ $(el.parentNode.parentNode).removeClass('d-none');
+ });
icon.find('img').attr('src', filterArrowUp);
}
});