diff --git a/libs/utils/utils.js b/libs/utils/utils.js index 5eca10a476..ed41f1ad0d 100644 --- a/libs/utils/utils.js +++ b/libs/utils/utils.js @@ -693,7 +693,9 @@ function decorateHeader() { const baseBreadcrumbs = getMetadata('breadcrumbs-base')?.length; const breadcrumbs = document.querySelector('.breadcrumbs'); const autoBreadcrumbs = getMetadata('breadcrumbs-from-url') === 'on'; - if (baseBreadcrumbs || breadcrumbs || autoBreadcrumbs) header.classList.add('has-breadcrumbs'); + const dynamicNavActive = getMetadata('dynamic-nav') === 'on' + && window.sessionStorage.getItem('gnavSource') !== null; + if (!dynamicNavActive && (baseBreadcrumbs || breadcrumbs || autoBreadcrumbs)) header.classList.add('has-breadcrumbs'); if (breadcrumbs) header.append(breadcrumbs); const promo = getMetadata('gnav-promo-source'); if (promo?.length) header.classList.add('has-promo'); diff --git a/test/blocks/global-navigation/global-navigation.test.js b/test/blocks/global-navigation/global-navigation.test.js index 1e8c687245..45dd8b5ce6 100644 --- a/test/blocks/global-navigation/global-navigation.test.js +++ b/test/blocks/global-navigation/global-navigation.test.js @@ -1437,4 +1437,19 @@ describe('global navigation', () => { ).to.be.true; }); }); + + describe('Dynamic nav', () => { + describe('Breadcrumbs', () => { + it('should not decorate breadcrumbs when dynamic nav is active', async () => { + const dynamicNavOn = toFragment``; + document.head.append(dynamicNavOn); + document.body.replaceChildren(toFragment``); + window.sessionStorage.setItem('dynamicNavKey', 'milo'); + window.sessionStorage.setItem('gnavSource', '/some-path'); + await initGnav(document.body.querySelector('header')); + const breadcrumbs = document.querySelector('.feds-breadcrumbs'); + expect(breadcrumbs).to.be.null; + }); + }); + }); });