Skip to content

Commit

Permalink
fix(storefront): BCTHEME-159 IDs used in ARIA and labels are not unique
Browse files Browse the repository at this point in the history
  • Loading branch information
BC-tymurbiedukhin committed Aug 25, 2020
1 parent 353c9c8 commit 0964619
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 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
- Fixed IDs used in ARIA and labels which are not unique. [#1791](https://github.com/bigcommerce/cornerstone/pull/1791)

## 4.9.0 (08-05-2020)

Expand Down
2 changes: 1 addition & 1 deletion assets/js/theme/global/quick-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function () {
const TOP_STYLING = 'top: 49px;';
const $quickSearchResults = $('.quickSearchResults');
const $quickSearchDiv = $('#quickSearch');
const $searchQuery = $('#search_query');
const $searchQuery = $('[data-search-quick]');
const stencilDropDownExtendables = {
hide: () => {
$searchQuery.trigger('blur');
Expand Down
2 changes: 1 addition & 1 deletion templates/components/common/navigation-menu.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<nav class="navPages">
<div class="navPages-quickSearch">
{{> components/common/quick-search}}
{{> components/common/quick-search name='nav-menu-quick-search'}}
</div>
<ul class="navPages-list{{#if theme_settings.navigation_design '!==' 'simple'}} navPages-list-depth-max{{/if}}">
{{#each categories}}
Expand Down
2 changes: 1 addition & 1 deletion templates/components/common/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@
</li>
</ul>
<div class="dropdown dropdown--quickSearch" id="quickSearch" aria-hidden="true" tabindex="-1" data-prevent-quick-search-close>
{{> components/common/quick-search}}
{{> components/common/quick-search name='nav-quick-search'}}
</div>
</nav>
11 changes: 9 additions & 2 deletions templates/components/common/quick-search.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
<form class="form" action="{{urls.search}}">
<fieldset class="form-fieldset">
<div class="form-field">
<label class="is-srOnly" for="search_query">{{lang "search.quick_search.input_label"}}</label>
<input class="form-input" data-search-quick name="search_query" id="search_query" data-error-message="{{lang 'search.error.empty_field'}}" placeholder="{{lang 'search.quick_search.input_placeholder'}}" autocomplete="off">
<label class="is-srOnly" for={{name}}>{{lang "search.quick_search.input_label"}}</label>
<input class="form-input"
data-search-quick
name={{name}}
id={{name}}
data-error-message="{{lang 'search.error.empty_field'}}"
placeholder="{{lang 'search.quick_search.input_placeholder'}}"
autocomplete="off"
>
</div>
</fieldset>
</form>
Expand Down

0 comments on commit 0964619

Please sign in to comment.