File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,6 +155,8 @@ function handleNavMenu() {
155155function handleMobileMenu ( ) {
156156 var menuBtn = document . querySelector ( '.menu-btn' ) ;
157157 var menuNav = document . querySelector ( '#menu' ) ;
158+ var main = document . querySelector ( 'main' ) ;
159+ var footer = document . querySelector ( 'footer' ) ;
158160
159161 function toggleNavMenu ( ) {
160162 var menuOpen = document . body . classList . toggle ( 'menu-open' ) ;
@@ -163,6 +165,10 @@ function handleMobileMenu() {
163165 var ariaLabel = menuOpen ? menuBtn . getAttribute ( 'data-close-text' ) : menuBtn . getAttribute ( 'data-open-text' ) ;
164166 menuBtn . setAttribute ( 'aria-label' , ariaLabel ) ;
165167
168+ // Toogle inert to keep focus in the menu and header
169+ main . toggleAttribute ( 'inert' ) ;
170+ footer . toggleAttribute ( 'inert' ) ;
171+
166172 /* When you open the menu, add an event listener to close it when clicking outside the menu area */
167173 /* Remove it on closing the menu */
168174 if ( menuBtn . getAttribute ( 'aria-expanded' ) === 'true' ) {
You can’t perform that action at this time.
0 commit comments