Skip to content

Commit f63c941

Browse files
committed
TD-5703: Fixed issues in auto suggestion and search feedback
1 parent ebb0111 commit f63c941

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

LearningHub.Nhs.WebUI/Controllers/SearchController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public async Task<IActionResult> Index(SearchRequestViewModel search, bool noSor
8181

8282
if (filterApplied)
8383
{
84-
await this.searchService.RegisterSearchEventsAsync(search, SearchFormActionTypeEnum.ApplyFilter, searchResult.ResourceSearchResult.TotalHits);
84+
await this.searchService.RegisterSearchEventsAsync(search, SearchFormActionTypeEnum.ApplyFilter, searchResult.ResourceSearchResult?.TotalHits ?? 0);
8585
}
8686

8787
if (noSortFilterError)

LearningHub.Nhs.WebUI/Views/Search/_SearchBar.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
function autocomplete(input, minLength) {
4949
if (input != null) {
5050
input.addEventListener("input", function () {
51-
var val = this.value;
52-
if (val.length < minLength) {
51+
var val = this.value.trimStart();
52+
if (val.length < minLength || val.trim() === "") {
5353
closeAllLists();
5454
return false;
5555
}

LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/Searchbar.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@
7272
function autocomplete(input, minLength) {
7373
if (input != null) {
7474
input.addEventListener("input", function () {
75-
var val = this.value;
76-
if (val.length < minLength) {
75+
var val = this.value.trimStart();
76+
if (val.length < minLength || val.trim() === "") {
7777
closeAllLists();
7878
return false;
7979
}

0 commit comments

Comments
 (0)