Skip to content

Commit

Permalink
fix(storefront): BCTHEME-222 Rating and Other filter sections are not…
Browse files Browse the repository at this point in the history
… accessible by keyboard (#1838)
  • Loading branch information
BC-tymurbiedukhin authored Oct 21, 2020
1 parent 9afd863 commit 5780596
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 68 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Changelog

- Fixed header logo focus border for voiceover and browser. [#1831](https://github.com/bigcommerce/cornerstone/pull/1831)

## Draft
- Rating and Other filter sections should be accessible by keyboard. [#1838](https://github.com/bigcommerce/cornerstone/pull/1838)
- Fixed header logo focus border for voiceover and browser. [#1831](https://github.com/bigcommerce/cornerstone/pull/1831)
- Unified browsers list that we support. [#1836](https://github.com/bigcommerce/cornerstone/pull/1836)
- Bump stencil utils and update hooks to account for refactor to drop Jquery in stencil utils [#1821](https://github.com/bigcommerce/cornerstone/pull/1821)

Expand Down
9 changes: 5 additions & 4 deletions assets/js/theme/common/collapsible.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ export class Collapsible {

// Assign DOM attributes
this.$target.attr('aria-hidden', this.isCollapsed);
this.$toggle
.attr('aria-label', $toggle.text().trim())
.attr('aria-controls', $target.attr('id'))
.attr('aria-expanded', this.isOpen);
this.$toggle.attr('aria-controls', $target.attr('id')).attr('aria-expanded', this.isOpen);

if (!this.$toggle.attr('aria-label')) {
this.$toggle.attr('aria-label', $toggle.text().trim());
}

// Listen
this.bindEvents();
Expand Down
34 changes: 17 additions & 17 deletions assets/js/theme/common/faceted-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ import collapsibleFactory from './collapsible';
import { Validators } from './utils/form-utils';
import nod from './nod';

const defaultOptions = {
accordionToggleSelector: '#facetedSearch .accordion-navigation, #facetedSearch .facetedSearch-toggle',
blockerSelector: '#facetedSearch .blocker',
clearFacetSelector: '#facetedSearch .facetedSearch-clearLink',
componentSelector: '#facetedSearch-navList',
facetNavListSelector: '#facetedSearch .navList',
priceRangeErrorSelector: '#facet-range-form .form-inlineMessage',
priceRangeFieldsetSelector: '#facet-range-form .form-fieldset',
priceRangeFormSelector: '#facet-range-form',
priceRangeMaxPriceSelector: '#facet-range-form [name=max_price]',
priceRangeMinPriceSelector: '#facet-range-form [name=min_price]',
showMoreToggleSelector: '#facetedSearch .accordion-content .toggleLink',
facetedSearchFilterItems: '#facetedSearch-filterItems .form-input',
modal: modalFactory('#modal')[0],
modalOpen: false,
};

/**
* Faceted search view component
*/
Expand All @@ -32,23 +49,6 @@ class FacetedSearch {
* let facetedSearch = new FacetedSearch(requestOptions, templatesDidLoad);
*/
constructor(requestOptions, callback, options) {
const defaultOptions = {
accordionToggleSelector: '#facetedSearch .accordion-navigation, #facetedSearch .facetedSearch-toggle',
blockerSelector: '#facetedSearch .blocker',
clearFacetSelector: '#facetedSearch .facetedSearch-clearLink',
componentSelector: '#facetedSearch-navList',
facetNavListSelector: '#facetedSearch .navList',
priceRangeErrorSelector: '#facet-range-form .form-inlineMessage',
priceRangeFieldsetSelector: '#facet-range-form .form-fieldset',
priceRangeFormSelector: '#facet-range-form',
priceRangeMaxPriceSelector: '#facet-range-form [name=max_price]',
priceRangeMinPriceSelector: '#facet-range-form [name=min_price]',
showMoreToggleSelector: '#facetedSearch .accordion-content .toggleLink',
facetedSearchFilterItems: '#facetedSearch-filterItems .form-input',
modal: modalFactory('#modal')[0],
modalOpen: false,
};

// Private properties
this.requestOptions = requestOptions;
this.callback = callback;
Expand Down
37 changes: 10 additions & 27 deletions assets/scss/components/foundation/accordion/_accordion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,19 @@
.accordion-title {
font-size: remCalc(15px);
margin: 0;
color: stencilColor("color-textHeading");
font-family: "Montserrat", Arial, Helvetica, sans-serif;
}

.accordion-navigation {
margin-top: -1px;
position: relative;
text-decoration: none;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
padding-right: 1rem;
}


Expand Down Expand Up @@ -64,11 +71,11 @@
}

.accordion-navigation {
padding-right: 70px;
@include breakpoint("medium") {
background-position: right 0 top 50%;
border: 0;
padding-right: 50px;
margin-bottom: spacing("half") !important;
padding: 0;
}
}

Expand All @@ -79,25 +86,13 @@
text-transform: inherit;

@include breakpoint("medium") {
margin-bottom: spacing("half");
margin-top: 0;
padding: 0;
}
}

.accordion-indicator {
fill: color("greys", "light");
}

.accordion-navigation-actions {
right: $accordion-navList-padding;
top: $accordion-navList-padding + spacing("eighth");

@include breakpoint("medium") {
right: 0;
top: 0;
}
}
}


Expand Down Expand Up @@ -132,18 +127,6 @@
}
}

// Accordion navigation actions
// -----------------------------------------------------------------------------
//
// Purpose: Action links, usually aligned to the right of .accordion-navigation
//
// -----------------------------------------------------------------------------
.accordion-navigation-actions {
position: absolute;
right: $accordion-navigation-paddingHorizontal;
top: $accordion-navigation-paddingVertical;
}

.accordion-nav-clear-holder {
position: relative;
}
Expand Down
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@
"rating": {
"and-up": "& up"
},
"toggleSection": "Toggle {title} filter section",
"clear": "Clear",
"more": "More",
"show-more": "Show More",
Expand Down
19 changes: 10 additions & 9 deletions templates/components/faceted-search/faceted-search-navigation.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
<div class="accordion-nav-clear-holder">
<div
class="accordion-navigation toggleLink{{#unless start_collapsed}} is-open{{/unless}}"
role="button"
data-collapsible="#facetedSearch-content--{{dashcase facet}}">
<h5 class="accordion-title">
<button type="button"
class="accordion-navigation toggleLink{{#unless start_collapsed}} is-open{{/unless}}"
data-collapsible="#facetedSearch-content--{{dashcase facet}}"
aria-label="{{lang 'search.faceted.toggleSection' title=title}}"
>
<span class="accordion-title">
{{title}}
</h5>
</span>

<div class="accordion-navigation-actions">
<span>
<svg class="icon accordion-indicator toggleLink-text toggleLink-text--off">
<use xlink:href="#icon-add" />
</svg>
<svg class="icon accordion-indicator toggleLink-text toggleLink-text--on">
<use xlink:href="#icon-remove" />
</svg>
</div>
</div>
</span>
</button>
{{#if selected}}
<a href="{{remove_url}}" class="facetedSearch-clearLink" data-faceted-search-facet>{{lang 'search.faceted.clear'}}</a>
{{/if}}
Expand Down
6 changes: 3 additions & 3 deletions templates/components/faceted-search/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
</a>

{{#any facets visible=true}}
<div
id="facetedSearch-navList"
class="facetedSearch-navList blocker-container">
<div id="facetedSearch-navList"
class="facetedSearch-navList"
>
<div class="accordion accordion--navList">
{{#each facets}}
{{#if visible}}
Expand Down
12 changes: 6 additions & 6 deletions templates/components/faceted-search/selected-facets.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ <h2 class="sidebarBlock-heading">
<ul class="inlineList inlineList--labels">
{{#each items}}
<li>
<a
href="{{url}}"
class="facetLabel"
rel="nofollow"
data-faceted-search-facet>
<a href="{{url}}"
class="facetLabel"
rel="nofollow"
data-faceted-search-facet
>
{{#if facet '===' 'rating'}}
{{lang 'search.faceted.selected.rating-label' rating=title}}
{{else}}
Expand All @@ -26,7 +26,7 @@ <h2 class="sidebarBlock-heading">
{{/each}}
</ul>
{{else}}
<p> {{lang 'search.faceted.selected.no-filters'}} </p>
<p>{{lang 'search.faceted.selected.no-filters'}}</p>
{{/if}}

{{#if remove_all_url}}
Expand Down

0 comments on commit 5780596

Please sign in to comment.