From 48a4a379772678f7fd7da59e446df0c15852ad17 Mon Sep 17 00:00:00 2001
From: Silvio Giebl <silvio.giebl@dc-square.de>
Date: Sun, 19 May 2019 02:41:18 +0200
Subject: [PATCH] js fixes

---
 assets/js/just-the-docs.js | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/assets/js/just-the-docs.js b/assets/js/just-the-docs.js
index cf54736f..e5a44496 100644
--- a/assets/js/just-the-docs.js
+++ b/assets/js/just-the-docs.js
@@ -108,7 +108,9 @@ function initSearch() {
             }
           } else {
             var next = document.querySelector('.search-result');
-            next.classList.add('active');
+            if (next) {
+              next.classList.add('active');
+            }
           }
           return;
         case 13: // enter
@@ -118,7 +120,9 @@ function initSearch() {
             active.click();
           } else {
             var first = document.querySelector('.search-result');
-            first.click();
+            if (first) {
+              first.click();
+            }
           }
           return;
       }
@@ -247,7 +251,9 @@ function initSearch() {
       }
     });
 
-    addEvent(searchInput, 'blur', hideResults);
+    addEvent(searchInput, 'blur', function(){
+      setTimeout(function(){ hideResults() }, 300);
+    });
   }
 }
 
-- 
GitLab