Skip to content

Commit

Permalink
Also focus when clear clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
clydebarrow committed Oct 28, 2024
1 parent eeddae0 commit 49e2a96
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions _templates/searchbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
</script>

0 comments on commit 49e2a96

Please sign in to comment.