Hide the results whenever anyone clicks outside

This commit is contained in:
Richard Feldman 2024-11-29 13:51:51 -05:00
parent 956d07f179
commit 52b261cf79
No known key found for this signature in database
GPG key ID: DAC334802F365236

View file

@ -27,6 +27,13 @@
let searchForm = document.getElementById("module-search-form");
let topSearchResultListItem = undefined;
// Hide the results whenever anyone clicks outside the search results.
window.addEventListener("click", function(event) {
if (!searchForm?.contains(event.target)) {
searchTypeAhead.classList.add("hidden");
}
});
if (searchBox != null) {
function searchKeyDown(event) {
switch (event.key) {