Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions assets/js/legacy-script.js

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can close the actual issue without updating this (legacy) file.

If we can, I say we should: the disposition of this script should be a separate rewrite.

Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,13 @@ var kub = (function () {
}

function toggleMenu() {
var hamburger = document.getElementById('hamburger');
// Clickable for Bootstrap "lg" and narrower
if (window.innerWidth < 992) {
pushmenu.show('primary');
if (hamburger) {
hamburger.setAttribute('aria-expanded', 'true');
}
}

else {
Expand All @@ -158,6 +162,10 @@ var kub = (function () {

header.css({height: px(newHeight)});
html.toggleClass('open-nav');
if (hamburger) {
var isOpen = html.hasClass('open-nav');
hamburger.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
}
}
}

Expand Down Expand Up @@ -467,6 +475,11 @@ var pushmenu = (function(){
function closeMe(e) {
if (e.target == sled) return;

var hamburger = document.getElementById('hamburger');
if (hamburger) {
hamburger.setAttribute('aria-expanded', 'false');
}

$(el).removeClass('on');
setTimeout(function(){
$(el).css({display: 'none'});
Expand Down
3 changes: 3 additions & 0 deletions i18n/en/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,9 @@ other = "See Also"
[sidebar_toggle_nav]
other = "Toggle section navigation"

[toggle_navigation]
other = "Toggle navigation"

[subscribe_button]
other = "Subscribe"

Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@
The menu overlay is added to the DOM and shown/hidden all by JS.
We should explore a Hugo way of doing this.
*/ -}}
<button id="hamburger" class="btn fas fa-bars" onclick="kub.toggleMenu()" data-auto-burger-exclude></button>
<button id="hamburger" class="btn fas fa-bars" onclick="kub.toggleMenu()" data-auto-burger-exclude aria-label="{{ T "toggle_navigation" }}" aria-expanded="false"></button>
</nav>