Skip to content

Commit fbcf3ab

Browse files
authoredNov 26, 2022
docs: fix searchbar clear button (#16585)
1 parent f894035 commit fbcf3ab

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed
 

‎docs/src/assets/js/search.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ function clearSearchResults() {
4949
resultsElement.removeChild(resultsElement.firstChild);
5050
}
5151
resultsElement.innerHTML = "";
52-
searchClearBtn.setAttribute('hidden', '');
5352
}
5453

5554
/**
@@ -80,13 +79,11 @@ function displaySearchResults(results) {
8079
`.trim();
8180
list.append(listItem);
8281
}
83-
searchClearBtn.removeAttribute('hidden');
8482

8583
} else {
8684
resultsLiveRegion.innerHTML = "No results found.";
8785
resultsElement.innerHTML = "No results found.";
8886
resultsElement.setAttribute('data-results', 'false');
89-
searchClearBtn.setAttribute('hidden', '');
9087
}
9188

9289
}
@@ -151,6 +148,7 @@ if(searchClearBtn)
151148
searchInput.value = '';
152149
searchInput.focus();
153150
clearSearchResults();
151+
searchClearBtn.setAttribute('hidden', '');
154152
});
155153

156154
document.addEventListener('keydown', function (e) {

0 commit comments

Comments
 (0)
Please sign in to comment.