hide search-results on blur (#1488)

This commit is contained in:
Mohsen Alizadeh 2021-06-03 21:38:47 +02:00 committed by GitHub
parent 7fab9b4774
commit 635159114d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,6 +168,12 @@ function initSearch() {
$searchResultsItems.appendChild(item); $searchResultsItems.appendChild(item);
} }
}, 150)); }, 150));
window.addEventListener('click', function(e) {
if ($searchResults.style.display == "block" && !$searchResults.contains(e.target)) {
$searchResults.style.display = "none";
}
});
} }