From 635159114dcc40216c0d47f665e169b55bd43ee4 Mon Sep 17 00:00:00 2001 From: Mohsen Alizadeh <4325532+mohsen-alizadeh@users.noreply.github.com> Date: Thu, 3 Jun 2021 21:38:47 +0200 Subject: [PATCH] hide search-results on blur (#1488) --- docs/static/search.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/static/search.js b/docs/static/search.js index c24a5962..68c63007 100644 --- a/docs/static/search.js +++ b/docs/static/search.js @@ -168,6 +168,12 @@ function initSearch() { $searchResultsItems.appendChild(item); } }, 150)); + + window.addEventListener('click', function(e) { + if ($searchResults.style.display == "block" && !$searchResults.contains(e.target)) { + $searchResults.style.display = "none"; + } + }); }