From 40ae6f8a1d2466af20eb7acc6cbc8665c60a2e1d Mon Sep 17 00:00:00 2001 From: Amaresh S M Date: Wed, 1 Jan 2025 23:49:09 +0530 Subject: [PATCH] chore: Fixing Focus Order by Rearranging Element Sequence (#673) * chore: Fixing Focus Order by Rearranging Element Sequence * hide results on focus --- src/_includes/components/search.html | 18 ++++++++++-------- src/assets/js/search.js | 7 +++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/_includes/components/search.html b/src/_includes/components/search.html index c477576e83..53e40f4e8c 100644 --- a/src/_includes/components/search.html +++ b/src/_includes/components/search.html @@ -9,7 +9,16 @@

{{ site.blog_page.search.hint }}

- +
+ +
Powered by
-
-
diff --git a/src/assets/js/search.js b/src/assets/js/search.js index 2dd39dd0d2..62b17964c4 100644 --- a/src/assets/js/search.js +++ b/src/assets/js/search.js @@ -24,9 +24,16 @@ const resultsLiveRegion = document.querySelector( ); const searchInput = document.querySelector("#search"); const searchClearBtn = document.querySelector("#search__clear-btn"); +const poweredByLink = document.querySelector(".search_powered-by-wrapper"); let activeIndex = -1; let searchQuery; +if (poweredByLink) { + poweredByLink.addEventListener("focus", function () { + clearSearchResults(); + }); +} + //----------------------------------------------------------------------------- // Helpers //-----------------------------------------------------------------------------