Add web/core/static/core/search-help.js

This commit is contained in:
Joshua Laymon 2025-08-14 16:31:44 +00:00
parent 62bd82b87e
commit 287b4353c2

View File

@ -0,0 +1,17 @@
<script>
document.addEventListener('click', (e) => {
const btn = e.target.closest('.help-toggle');
const panel = document.querySelector((btn && btn.dataset.target) || '#search-help-panel');
// Toggle when clicking the help button
if (btn && panel) {
panel.classList.toggle('open');
return;
}
// Click outside closes it
if (panel && panel.classList.contains('open') && !panel.contains(e.target)) {
const clickedHelpButton = e.target.closest('.help-toggle');
if (!clickedHelpButton) panel.classList.remove('open');
}
});
</script>