Skip to content

Commit 18b76fa

Browse files
authored
fix: Generalize scroll-handling to touches on mobile (#423)
Before, the behaviour was limited to scroll events. However, if there are not enough search results to show a search bar, the event doesn't trigger. This PR updates the corresponding Javascript to close the keyboard on mobile during touch events.
1 parent a53b506 commit 18b76fa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

assets/js/search.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ const initSearch = () => {
2727
},
2828
});
2929

30-
// Close keyboard when scrolling in search results (mobile only)
30+
// Close keyboard when touching search results (mobile only)
3131
const searchDrawer = search.querySelector(".pagefind-ui__drawer");
32-
searchDrawer.addEventListener("scroll", () => {
32+
searchDrawer.addEventListener("touchstart", () => {
3333
if (!isMobile) return;
3434
if (document.activeElement && document.activeElement.blur) {
3535
document.activeElement.blur();

0 commit comments

Comments
 (0)