Skip to content

Commit

Permalink
Fix: Add search field label element (fixes #67) (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
swashbuck authored Sep 27, 2023
1 parent f244425 commit 6b6f1c9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
1 change: 0 additions & 1 deletion js/SEARCH_DEFAULTS.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
const SEARCH_DEFAULTS = {

title: 'Search',
description: 'Type in search words',
placeholder: '',
noResultsMessage: 'Sorry, no results were found',
awaitingResultsMessage: 'Formulating results...',
Expand Down
2 changes: 0 additions & 2 deletions js/adapt-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ class Search extends Backbone.Controller {
addDrawerItem() {
const searchConfig = Adapt.course.get('_search');
searchConfig.title = searchConfig.title || 'Search';
searchConfig.description = searchConfig.description || 'Description';
const drawerObject = {
title: searchConfig.title,
description: searchConfig.description,
className: 'is-search',
drawerOrder: searchConfig._drawerOrder || 0
};
Expand Down
6 changes: 6 additions & 0 deletions less/search.less
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
}
}

&__textbox-label {
display: block;
margin-bottom: (@item-padding / 2);
.drawer-item-body;
}

&__items-container {
border-top: 1px solid @drawer-item-hover;

Expand Down
3 changes: 2 additions & 1 deletion templates/searchBox.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<div class="search__textbox-container">
<input class="search__textbox js-search-textbox-change" type="text" placeholder="{{placeholder}}">
<label for="search__textbox" class="search__textbox-label{{#unless description}} aria-label{{/unless}}">{{#if description}}{{{description}}}{{/if}}{{#unless description}}{{{title}}}{{/unless}}</label>
<input id="search__textbox" class="search__textbox js-search-textbox-change" type="text" placeholder="{{placeholder}}">
</div>
8 changes: 0 additions & 8 deletions templates/searchSingleItem.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,5 @@
</div>
{{/if}}

{{#if description}}
<div class="drawer__item-description">
<div class="drawer__item-description-inner">
{{{a11y_text description}}}
</div>
</div>
{{/if}}

</div>
</div>

0 comments on commit 6b6f1c9

Please sign in to comment.