diff --git a/blocks/header/header.js b/blocks/header/header.js index ef494a184..c8eade44a 100644 --- a/blocks/header/header.js +++ b/blocks/header/header.js @@ -282,6 +282,9 @@ export default async function decorate(block) { block.append(navWrapper); // TODO: Following statements added for demo purpose (Auth Drop-In) - renderAuthCombine(navSections); + renderAuthCombine( + navSections, + () => !isDesktop.matches && toggleMenu(nav, navSections, false), + ); renderAuthDropdown(navTools); } diff --git a/blocks/header/renderAuthCombine.js b/blocks/header/renderAuthCombine.js index a7cbc9b08..18797b1e2 100644 --- a/blocks/header/renderAuthCombine.js +++ b/blocks/header/renderAuthCombine.js @@ -165,7 +165,7 @@ const onHeaderLinkClick = () => { })(signInForm); }; -const renderAuthCombine = (navSections) => { +const renderAuthCombine = (navSections, toggleMenu) => { if (getCookie('auth_dropin_firstname')) return; const navListEl = navSections.querySelector('.default-content-wrapper > ul'); @@ -176,7 +176,10 @@ const renderAuthCombine = (navSections) => { const authCombineLink = accountLiItems[accountLiItems.length - 1]; authCombineLink.classList.add('authCombineNavElement'); - authCombineLink.addEventListener('click', () => { + const text = authCombineLink.textContent || ''; + authCombineLink.innerHTML = `${text}`; + authCombineLink.addEventListener('click', (event) => { + event.preventDefault(); onHeaderLinkClick(); function getPopupElements() { @@ -219,6 +222,8 @@ const renderAuthCombine = (navSections) => { ); } }); + + toggleMenu?.(); }); };