Skip to content

Commit

Permalink
Fix mobile icons and opening issue. (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
bstopp authored Nov 30, 2023
1 parent 19453db commit b6c429b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
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

0 comments on commit b6c429b

Please sign in to comment.