From 7342ef6c098b01b9fabdc67f51cb808acc642083 Mon Sep 17 00:00:00 2001 From: Vennela Date: Fri, 15 Nov 2024 23:52:45 +0530 Subject: [PATCH] Fix: Keep cursor in search box after applying filter --- assets/html/js/search.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/assets/html/js/search.js b/assets/html/js/search.js index 038095cb40..fbd69c9c3d 100644 --- a/assets/html/js/search.js +++ b/assets/html/js/search.js @@ -504,6 +504,9 @@ function runSearchMainCode() { } $(".search-modal-card-body").html(search_result_container); + // Refocus the search input field when there's no search query + $(".documenter-search-input").focus(); + } else { if (!$(".search-modal-card-body").hasClass("is-justify-content-center")) { $(".search-modal-card-body").addClass("is-justify-content-center"); @@ -512,6 +515,8 @@ function runSearchMainCode() { $(".search-modal-card-body").html(`
Type something to get started!
`); + // Refocus the search input field when there's no search query + $(".documenter-search-input").focus(); } }