Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mobile icons and opening issue. #174

Merged
merged 1 commit into from
Nov 30, 2023
Merged
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
15 changes: 13 additions & 2 deletions blocks/header/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ body.light-nav {
font-family: var(--font-family-proxima);
font-weight: var(--font-weight-normal);
font-size: var(--body-font-size-s);
letter-spacing:var(--letter-spacing-reg);
letter-spacing: var(--letter-spacing-reg);
line-height: var(--body-font-size-s);
text-decoration: none;
cursor: pointer;
Expand Down Expand Up @@ -197,6 +197,7 @@ body.light-nav {
}

.header.block nav .nav-hamburger .nav-hamburger-icon {
position: relative;
height: 24px;
width: 24px;
}
Expand All @@ -208,9 +209,19 @@ body.light-nav {

.header.block nav .nav-hamburger .close {
display: none;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
}

.header.block nav .nav-hamburger .open {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
filter: var(--hamburger-filter);
}

Expand Down Expand Up @@ -239,7 +250,7 @@ body.light-nav {
height: var(--nav-height);
background: transparent;
}

body.light-nav .header.block nav[aria-expanded="true"] {
--logo-filter: invert(1);
}
Expand Down
6 changes: 4 additions & 2 deletions blocks/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { BREAKPOINTS } from '../../scripts/scripts.js';
import { getMetadata, decorateIcons, decorateSections } from '../../scripts/aem.js';

// media query match that indicates mobile/tablet width
const isDesktop = BREAKPOINTS.medium;
const isDesktop = BREAKPOINTS.large;

function closeOnEscape(e) {
if (e.code === 'Escape') {
Expand Down Expand Up @@ -230,7 +230,9 @@ export default async function decorate(block) {
nav.setAttribute('aria-expanded', 'false');
// prevent mobile nav behavior on window resize
toggleMenu(nav, navSections, isDesktop.matches);
isDesktop.addEventListener('change', () => toggleMenu(nav, navSections, isDesktop.matches));
isDesktop.addEventListener('change', () => {
toggleMenu(nav, navSections, isDesktop.matches);
});

decorateIcons(nav);
const navWrapper = document.createElement('div');
Expand Down