Fix search input losing focus on mouse click

The click-outside handler was checking for .subhead (a BEM class removed
in the Tailwind refactor) so every click including on the input itself
triggered closeSearch(). Now checks for the actual search label and popup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 18:10:55 +02:00
parent 54a87dc4ed
commit 598e2f0593
2 changed files with 12 additions and 2 deletions
+6 -1
View File
@@ -187,7 +187,12 @@
}
document.addEventListener('click', e => {
if (searchPop && searchPop.dataset.open === 'true' && !e.target.closest('.subhead')) closeSearch();
if (searchPop && searchPop.dataset.open === 'true') {
const inSearch = e.target.closest('label[for="searchInput"]')
|| e.target.id === 'searchInput'
|| e.target.closest('#searchpop');
if (!inSearch) closeSearch();
}
});
function closeSearch() {