diff --git a/package-lock.json b/package-lock.json index 127df9d7..90ad55d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "19.5.6", + "version": "19.5.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "19.5.6", + "version": "19.5.7", "license": "MIT", "dependencies": { "@cdransf/api-text": "^1.4.0", diff --git a/package.json b/package.json index eafca847..eaf7b00f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "19.5.6", + "version": "19.5.7", "description": "The source for my personal site. Built using 11ty.", "type": "module", "scripts": { diff --git a/src/_includes/partials/nav/menu.liquid b/src/_includes/partials/nav/menu.liquid index fce519d4..fb067d0f 100644 --- a/src/_includes/partials/nav/menu.liquid +++ b/src/_includes/partials/nav/menu.liquid @@ -5,6 +5,7 @@
diff --git a/src/assets/scripts/menu.js b/src/assets/scripts/menu.js index fe6bf6a4..ede1de67 100644 --- a/src/assets/scripts/menu.js +++ b/src/assets/scripts/menu.js @@ -1,5 +1,6 @@ window.addEventListener('load', () => { const menuInput = document.getElementById('menu-toggle') + const menuLabelText = document.getElementById('menu-label-text') const menuButtonContainer = document.querySelector('.menu-button-container') const menuItems = document.querySelectorAll('.menu-primary li[role="menu-item"]') const isMobile = () => window.innerWidth <= 768 @@ -12,6 +13,14 @@ window.addEventListener('load', () => { const link = item.querySelector('a') if (link) link.setAttribute('tabindex', isMobile() && !isExpanded ? '-1' : '0') }) + if(isExpanded) { + menuLabelText.textContent = 'Close mobile menu' + } + + if (!isExpanded) { + menuLabelText.textContent = 'Open mobile menu' + menuButtonContainer.focus() + } } updateTabIndex() diff --git a/src/assets/styles/base/index.css b/src/assets/styles/base/index.css index 197a3014..d15eae4d 100644 --- a/src/assets/styles/base/index.css +++ b/src/assets/styles/base/index.css @@ -554,6 +554,16 @@ li { display: none !important; } +.screen-readers-only:not(:focus):not(:active) { + clip: rect(0 0 0 0); + clip-path: inset(50%); + height: 1px; + overflow: hidden; + position: absolute; + white-space: nowrap; + width: 1px; +} + .text-centered { text-align: center !important; }