From 394f46fde355d2b9e3e4b6044bbf6e9761f1459a Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Thu, 29 Feb 2024 15:20:37 +1300 Subject: [PATCH] add aria-expanded when mobile nav shown --- app/static/js/scripts.js | 5 ++++- app/templates/base.html | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/static/js/scripts.js b/app/static/js/scripts.js index 29a8f709..18f95680 100644 --- a/app/static/js/scripts.js +++ b/app/static/js/scripts.js @@ -23,8 +23,11 @@ window.addEventListener("load", function () { function setupMobileNav() { var navbarToggler = document.getElementById('navbar-toggler'); + var navbarSupportedContent = document.getElementById('navbarSupportedContent'); navbarToggler.addEventListener("click", function(event) { - toggleClass('navbarSupportedContent', 'show_menu') + toggleClass('navbarSupportedContent', 'show_menu'); + var isExpanded = navbarSupportedContent.classList.contains('show_menu'); + navbarSupportedContent.setAttribute('aria-expanded', isExpanded ? 'true' : 'false'); }); } diff --git a/app/templates/base.html b/app/templates/base.html index c2552f3b..9749e7d7 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -116,7 +116,7 @@ -