Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions orthocal/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@
toggle.setAttribute('aria-expanded', isOpen);
});
});

// Native <details> only closes on a second click on its own
// <summary> (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');
}
});
});
</script>

{% block scripts %}{% endblock %}
Expand Down