From 8a6ebd193933c2879c2a36e1b2f164889575d3bc Mon Sep 17 00:00:00 2001
From: Justin Fowler <justin.fowler@hey.com>
Date: Fri, 02 Feb 2024 04:17:21 +0000
Subject: [PATCH] docs: clarity for `RecentNotes` (#786)

---
 quartz/components/scripts/search.inline.ts |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/quartz/components/scripts/search.inline.ts b/quartz/components/scripts/search.inline.ts
index 7871b39..8ead5c9 100644
--- a/quartz/components/scripts/search.inline.ts
+++ b/quartz/components/scripts/search.inline.ts
@@ -238,7 +238,7 @@
       e.preventDefault()
       // The results should already been focused, so we need to find the next one.
       // The activeElement is the search bar, so we need to find the first result and focus it.
-      if (!results?.contains(document.activeElement)) {
+      if (document.activeElement === searchBar || currentHover !== null) {
         const firstResult = currentHover
           ? currentHover
           : (document.getElementsByClassName("result-card")[0] as HTMLInputElement | null)
@@ -398,6 +398,7 @@
         removeAllChildren(preview as HTMLElement)
       } else {
         firstChild.classList.add("focus")
+        currentHover = firstChild as HTMLInputElement
         await displayPreview(firstChild)
       }
     }

--
Gitblit v1.10.0