Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix searchbar clear button #16585

Merged
merged 2 commits into from Nov 26, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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