diff --git a/header.php b/header.php index 5f0d5e5fd1..ee7a393a77 100644 --- a/header.php +++ b/header.php @@ -29,7 +29,7 @@ diff --git a/js/navigation.js b/js/navigation.js index 706e4d85b7..13a4e448f3 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -7,12 +7,14 @@ var container, button, menu; container = document.getElementById( 'site-navigation' ); - if ( ! container ) + if ( ! container ) { return; + } button = container.getElementsByTagName( 'button' )[0]; - if ( 'undefined' === typeof button ) + if ( 'undefined' === typeof button ) { return; + } menu = container.getElementsByTagName( 'ul' )[0]; @@ -22,13 +24,21 @@ return; } - if ( -1 === menu.className.indexOf( 'nav-menu' ) ) + menu.setAttribute( 'aria-expanded', 'false' ); + + if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { menu.className += ' nav-menu'; + } button.onclick = function() { - if ( -1 !== container.className.indexOf( 'toggled' ) ) + if ( -1 !== container.className.indexOf( 'toggled' ) ) { container.className = container.className.replace( ' toggled', '' ); - else + button.setAttribute( 'aria-expanded', 'false' ); + menu.setAttribute( 'aria-expanded', 'false' ); + } else { container.className += ' toggled'; + button.setAttribute( 'aria-expanded', 'true' ); + menu.setAttribute( 'aria-expanded', 'true' ); + } }; } )();