Skip to content

Commit

Permalink
docs: fix searchbar clear button (#16585)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanpriyan committed Nov 26, 2022
1 parent f894035 commit fbcf3ab
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions docs/src/assets/js/search.js
Expand Up @@ -49,7 +49,6 @@ function clearSearchResults() {
resultsElement.removeChild(resultsElement.firstChild);
}
resultsElement.innerHTML = "";
searchClearBtn.setAttribute('hidden', '');
}

/**
Expand Down Expand Up @@ -80,13 +79,11 @@ function displaySearchResults(results) {
`.trim();
list.append(listItem);
}
searchClearBtn.removeAttribute('hidden');

} else {
resultsLiveRegion.innerHTML = "No results found.";
resultsElement.innerHTML = "No results found.";
resultsElement.setAttribute('data-results', 'false');
searchClearBtn.setAttribute('hidden', '');
}

}
Expand Down Expand Up @@ -151,6 +148,7 @@ if(searchClearBtn)
searchInput.value = '';
searchInput.focus();
clearSearchResults();
searchClearBtn.setAttribute('hidden', '');
});

document.addEventListener('keydown', function (e) {
Expand Down

0 comments on commit fbcf3ab

Please sign in to comment.