From: Marc Foley Date: Thu, 21 Nov 2024 10:26:52 +0000 (+0000) Subject: tags.html: close open dropdown when user clicks elsewhere X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8518%2Fhead;p=thirdparty%2Fgoogle%2Ffonts.git tags.html: close open dropdown when user clicks elsewhere --- diff --git a/.ci/tags.html b/.ci/tags.html index 0f533513c5..6bf7a8428f 100644 --- a/.ci/tags.html +++ b/.ci/tags.html @@ -413,6 +413,15 @@ } } // methods ) + // close open navbar dropdowns when user clicks elsewhere + var details = [...document.querySelectorAll('details')]; + document.addEventListener('click', function(e) { + if (!details.some(f => f.contains(e.target))) { + details.forEach(f => f.removeAttribute('open')); + } else { + details.forEach(f => !f.contains(e.target) ? f.removeAttribute('open') : ''); + } +})