diff --git a/orthocal/templates/base.html b/orthocal/templates/base.html index 4eed98d..733e5eb 100644 --- a/orthocal/templates/base.html +++ b/orthocal/templates/base.html @@ -111,6 +111,18 @@ toggle.setAttribute('aria-expanded', isOpen); }); }); + + // Native
only closes on a second click on its own + // (or when a sibling in the same name= group opens) -- + // it doesn't close on a click elsewhere on the page, which reads + // as broken for a nav dropdown. + document.addEventListener('click', function (event) { + document.querySelectorAll('.topbar-inner > nav details[open]').forEach(function (details) { + if (!details.contains(event.target)) { + details.removeAttribute('open'); + } + }); + }); {% block scripts %}{% endblock %}