fix #28: accessibility concerns
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
<body>
|
||||
<button class="back-to-top-button" aria-label="back to top">↑</button>
|
||||
<nav class="sidebar" aria-label="Table of Contents">
|
||||
<button class="hamburger hamburger--spin sidebar__menu" type="button" aria-label="Menu">
|
||||
<button class="hamburger hamburger--spin sidebar__menu" type="button" aria-label="Menu" aria-expanded="false">
|
||||
<span class="hamburger-box">
|
||||
<span class="hamburger-inner"></span>
|
||||
</span>
|
||||
|
||||
@ -5,7 +5,13 @@ const menu = select('.hamburger')
|
||||
const links = select('.sidebar__links')
|
||||
const ACTIVE_CLASS = 'is-active'
|
||||
|
||||
const toggle = () => [menu, links].forEach(el => el.classList.toggle(ACTIVE_CLASS))
|
||||
const toggle = () => {
|
||||
[menu, links].forEach(el => el.classList.toggle(ACTIVE_CLASS))
|
||||
menu.setAttribute(
|
||||
'aria-expanded',
|
||||
menu.classList.contains(ACTIVE_CLASS) ? 'true' : 'false'
|
||||
)
|
||||
}
|
||||
|
||||
menu.addEventListener('click', toggle)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user