accessibility

This commit is contained in:
rimu 2024-02-29 22:17:01 +13:00
parent 9f8e711373
commit 89460df9d4
2 changed files with 5 additions and 1 deletions

View file

@ -27,8 +27,12 @@ function setupMobileNav() {
navbarToggler.addEventListener("click", function(event) { navbarToggler.addEventListener("click", function(event) {
toggleClass('navbarSupportedContent', 'show_menu'); toggleClass('navbarSupportedContent', 'show_menu');
var isExpanded = navbarSupportedContent.classList.contains('show_menu'); var isExpanded = navbarSupportedContent.classList.contains('show_menu');
navbarToggler.setAttribute('aria-expanded', isExpanded ? 'true' : 'false');
navbarSupportedContent.setAttribute('aria-expanded', isExpanded ? 'true' : 'false'); navbarSupportedContent.setAttribute('aria-expanded', isExpanded ? 'true' : 'false');
}); });
if(window.innerWidth < 992) {
navbarToggler.setAttribute('aria-expanded', 'false');
}
} }
function setupLightDark() { function setupLightDark() {

View file

@ -112,7 +112,7 @@
</a> </a>
{% endif %} {% endif %}
<button id="navbar-toggler" class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <button id="navbar-toggler" class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="true" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>