Skip to content

Commit

Permalink
Merge branch 'mobile-gnav' of https://github.com/adobecom/milo into m…
Browse files Browse the repository at this point in the history
…obile-gnav-ios-scroll-flicker
  • Loading branch information
sharmrj committed Jan 7, 2025
2 parents 84b04f9 + 5946c8e commit b01aee4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions libs/blocks/global-navigation/global-navigation.css
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,7 @@ header.new-nav .feds-nav > section.feds-navItem > .feds-popup .tabs button {
font-weight: 700;
text-align: unset;
color: var(--text-color);
font-family: var(--body-font-family);
}

header.new-nav .feds-nav > section.feds-navItem > .feds-popup .tabs button[aria-selected="true"] {
Expand Down Expand Up @@ -1088,6 +1089,7 @@ header.new-nav .feds-breadcrumbs li:first-child:not(:nth-last-child(-n+3)):after
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-family: var(--body-font-family);
}

.feds-localnav-items {
Expand Down
13 changes: 9 additions & 4 deletions libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ class Gnav {
}

// eslint-disable-next-line no-return-assign
getOriginalTitle = (localNavItems) => this.originalTitle ||= localNavItems[0]?.querySelector('a')?.textContent?.split('|');
getOriginalTitle = (firstElem) => this.originalTitle ||= firstElem.textContent?.split('|');

setupUniversalNav = () => {
const meta = getMetadata('universal-nav')?.toLowerCase();
Expand Down Expand Up @@ -380,8 +380,13 @@ class Gnav {

decorateLocalNav = async () => {
if (!this.isLocalNav()) return;
const localNavItems = this.elements.navWrapper.querySelector('.feds-nav').querySelectorAll('.feds-navItem:not(.feds-navItem--section)');
const [title, navTitle = ''] = this.getOriginalTitle(localNavItems);
const localNavItems = this.elements.navWrapper.querySelector('.feds-nav').querySelectorAll('.feds-navItem:not(.feds-navItem--section, .feds-navItem--mobile-only)');
const firstElem = localNavItems[0]?.querySelector('a');
if (!firstElem) {
lanaLog({ message: 'GNAV: Incorrect authoring of localnav found.', tags: 'errorType=info,module=gnav' });
return;
}
const [title, navTitle = ''] = this.getOriginalTitle(firstElem);
let localNav = document.querySelector('.feds-localnav');
if (!localNav) {
lanaLog({
Expand Down Expand Up @@ -970,7 +975,7 @@ class Gnav {
setActiveLink(true);
}
}
if (this.newMobileNav) {
if (this.newMobileNav && !isDesktop.matches) {
await this.decorateLocalNav();
}
return this.elements.mainNav;
Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/global-navigation/utilities/keyboard/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const selectors = {
menuContent: '.feds-menu-content',
/* mobile redesign popup selectors */
mainMenuItems: 'header.new-nav section.feds-navItem > button',
mainMenuLinks: ' header.new-nav .feds-navItem > a',
mainMenuLinks: 'header.new-nav .feds-navItem > a[href]',
activePopup: 'header.new-nav section.feds-dropdown--active > .feds-popup',
tab: 'button[role="tab"]',
activeTabpanel: '.tab-content [role="tabpanel"]',
Expand Down

0 comments on commit b01aee4

Please sign in to comment.