Skip to content

Commit 394fd49

Browse files
committed
Add support for nav without JS enabled
Page defaults to assuming JS is not available. When navigation JS loads it adds a JS class to <html>. Without that class, desktop dropdown is opened on hover or keyboard focus.
1 parent 261bb54 commit 394fd49

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎css/main.scss‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,9 @@ header {
343343
transform: translateY(-50%) scale(1);
344344
}
345345

346-
&.dropdown.open .dropdown-content {
346+
&.dropdown.open .dropdown-content,
347+
html:not(.js) &.dropdown:hover .dropdown-content,
348+
html:not(.js) &.dropdown:focus-within .dropdown-content {
347349
visibility: visible;
348350
opacity: 1;
349351
pointer-events: auto;

‎js/hamburger.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
document.documentElement.classList.add("js");
2+
13
document.addEventListener("DOMContentLoaded", () => {
24
const hamburger = document.getElementById("hamburger");
35
const menu = document.getElementById("hamburger-menu");

0 commit comments

Comments
 (0)