From 49e2a962142e9c4eb8b6dac3351b225278a615b1 Mon Sep 17 00:00:00 2001 From: clydebarrow <2366188+clydebarrow@users.noreply.github.com> Date: Mon, 28 Oct 2024 21:52:05 +1100 Subject: [PATCH] Also focus when clear clicked --- _templates/searchbox.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/_templates/searchbox.html b/_templates/searchbox.html index dbe45fc9cc..13b8221f85 100644 --- a/_templates/searchbox.html +++ b/_templates/searchbox.html @@ -212,5 +212,10 @@ } // focus the search field on page load. search_focus(); + // focus when clicking on clear button + const clears = document.getElementsByClassName("pagefind-modular-list-clear"); + for (let i = 0; i !== clears.length; i++) { + clears[i].addEventListener("click", search_focus); + } });