Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Revert "chore: update query length to 4"
Browse files Browse the repository at this point in the history
This reverts commit 1478660.
  • Loading branch information
ShayPunter committed Apr 20, 2023
1 parent 378850a commit c340940
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions site/_js/web-components/search-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,13 @@ export class SearchBox extends BaseElement {
return;
}

// todo: need help with displaying some sort of value for this.
if (this.query.length < 3) {
this.results = [];
this.categorisedResults = {};
return;
}

try {
const {hits: results} = await index.search(query, {
hitsPerPage: 10,
Expand Down Expand Up @@ -428,6 +435,21 @@ export class SearchBox extends BaseElement {
return;
}

if (this.query.length < 3) {
return html`
<div
id="search-box__results"
class="search-box__results"
role="listbox"
aria-label="${this.placeholder}"
>
<div class="search-box__result-heading type--label">
Please enter at least 3 characters for search suggestions.
</div>
</div>
`;
}

this.resultsCounter = -1;
return html`
<div
Expand Down

0 comments on commit c340940

Please sign in to comment.