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

[Release] Stage to Main #3570

Merged
merged 10 commits into from
Jan 29, 2025
Merged
1 change: 1 addition & 0 deletions libs/blocks/carousel/img/arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ const setBreadcrumbSEO = (breadcrumbs) => {
};
breadcrumbs.querySelectorAll('ul > li').forEach((item, idx) => {
const link = item.querySelector('a');
const name = link ? link.innerText.trim() : [...item.childNodes].filter((node) => !node.matches?.('span[aria-hidden="true"]')).map((node) => node.textContent.trim()).join('');
breadcrumbsSEO.itemListElement.push({
'@type': 'ListItem',
position: idx + 1,
name: link ? link.innerText.trim() : item.innerText.trim(),
name,
item: link?.href,
});
});
Expand All @@ -53,8 +54,9 @@ const createBreadcrumbs = (element) => {
.split(',')
.map((item) => item.trim()) || [];

ul.querySelectorAll('li').forEach((li) => {
ul.querySelectorAll('li').forEach((li, index) => {
if (hiddenEntries.includes(li.innerText?.toLowerCase().trim())) li.remove();
if (index > 0) li.insertAdjacentHTML('afterbegin', '<span aria-hidden="true">/</span>');
});

const noTransform = element.classList.contains('no-transform') ? ' no-transform' : '';
Expand Down
3 changes: 1 addition & 2 deletions libs/blocks/global-navigation/global-navigation.css
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,8 @@ header.global-navigation {
color: var(--feds-color-breadcrumbs--current);
}

.feds-breadcrumbs li:not(:first-of-type)::before {
.feds-breadcrumbs li span[aria-hidden="true"] {
padding: 0 12px;
content: '/';
}

.feds-utilities {
Expand Down
15 changes: 2 additions & 13 deletions libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
getActiveLink,
getAnalyticsValue,
getExperienceName,
hasActiveLink,
isActiveLink,
icons,
isDesktop,
Expand All @@ -28,7 +27,6 @@ import {
logErrorFor,
selectors,
setActiveDropdown,
setActiveLink,
setCurtainState,
setUserProfile,
toFragment,
Expand All @@ -38,12 +36,12 @@ import {
isDarkMode,
darkIcons,
setDisableAEDState,
getDisableAEDState,
animateInSequence,
transformTemplateToMobile,
closeAllTabs,
disableMobileScroll,
enableMobileScroll,
setAsyncDropdownCount,
} from './utilities/utilities.js';
import { getFedsPlaceholderConfig } from '../../utils/federated.js';

Expand Down Expand Up @@ -997,16 +995,6 @@ class Gnav {
this.elements.mainNav.appendChild(mainNavItem);
}
}

if (!hasActiveLink()) {
const sections = this.elements.mainNav.querySelectorAll('.feds-navItem--section');
const disableAED = getDisableAEDState();

if (!disableAED && sections.length === 1) {
sections[0].classList.add(selectors.activeNavItem.slice(1));
setActiveLink(true);
}
}
if (this.newMobileNav) {
await this.decorateLocalNav();
}
Expand Down Expand Up @@ -1301,6 +1289,7 @@ export default async function init(block) {
setDisableAEDState();
}
const content = await fetchAndProcessPlainHtml({ url });
setAsyncDropdownCount(content.querySelectorAll('.large-menu').length);
if (!content) {
const error = new Error('Could not create global navigation. Content not found!');
error.tags = 'errorType=error,module=gnav';
Expand Down
17 changes: 16 additions & 1 deletion libs/blocks/global-navigation/utilities/menu/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import {
trigger,
yieldToMain,
addMepHighlightAndTargetId,
getAsyncDropdownCount,
setActiveLink,
getDisableAEDState,
hasActiveLink,
} from '../utilities.js';

const decorateHeadline = (elem, index) => {
Expand Down Expand Up @@ -304,6 +308,7 @@ const decorateCrossCloudMenu = (content) => {

// Current limitation: after an h5 (or h2 in the case of the footer)
// is found in a menu column, no new sections can be created without a heading
let asyncDropDownCount = 0;
const decorateMenu = (config) => logErrorFor(async () => {
let menuTemplate;
if (config.type === 'syncDropdownTrigger') {
Expand All @@ -327,7 +332,6 @@ const decorateMenu = (config) => logErrorFor(async () => {
const content = await fetchAndProcessPlainHtml({ url: pathElement.href });

if (!content) return;

const menuContent = toFragment`<div class="feds-menu-content">${content.innerHTML}</div>`;
menuTemplate = toFragment`<div class="feds-popup">
<div class="feds-menu-container">
Expand Down Expand Up @@ -359,7 +363,18 @@ const decorateMenu = (config) => logErrorFor(async () => {
config.template.classList.add(selectors.activeNavItem.slice(1));
}

asyncDropDownCount += 1;
config.template.classList.add('feds-navItem--megaMenu');
if (getAsyncDropdownCount() === asyncDropDownCount) {
if (!hasActiveLink()) {
const sections = document.querySelectorAll('.feds-nav .feds-navItem--megaMenu');
const disableAED = getDisableAEDState();
if (!disableAED && sections.length === 1) {
sections[0].classList.add(selectors.activeNavItem.slice(1));
setActiveLink(true);
}
}
}
}

if (config.type === 'footerMenu') {
Expand Down
8 changes: 8 additions & 0 deletions libs/blocks/global-navigation/utilities/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ export const [setDisableAEDState, getDisableAEDState] = (() => {
];
})();

export const [setAsyncDropdownCount, getAsyncDropdownCount] = (() => {
let asyncDropdownCount = 0;
return [
(val) => { asyncDropdownCount = val; },
() => asyncDropdownCount,
];
})();

export const [hasActiveLink, setActiveLink, isActiveLink, getActiveLink] = (() => {
let activeLinkFound;
const { origin, pathname } = window.location;
Expand Down
15 changes: 13 additions & 2 deletions libs/blocks/preflight/panels/seo.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ async function checkLinks() {
&& !link.closest('.preflight') // Is not inside preflight
&& !knownBadUrls.some((url) => url === link.hostname) // Is not a known bad url
) {
link.liveHref = link.href.replace('hlx.page', 'hlx.live');
link.liveHref = link.href.replace('aem.page', 'aem.live');
link.liveHref = link.href;
if (link.href.includes('hlx.page')) link.liveHref = link.href.replace('hlx.page', 'hlx.live');
if (link.href.includes('aem.page')) link.liveHref = link.href.replace('aem.page', 'aem.live');
return true;
}
return false;
Expand All @@ -238,6 +239,16 @@ async function checkLinks() {
const baseOpts = { method: 'POST', headers: { 'Content-Type': 'application/json' } };
const badResults = [];

[...document.querySelectorAll('a')].forEach((link) => {
if (link.dataset?.httpLink) {
const httpLink = {
url: link.liveHref,
status: 'authored as http',
};
badResults.push(httpLink);
}
});

for (const group of groups) {
const urls = group.map((link) => link.liveHref);
const opts = { ...baseOpts, body: JSON.stringify({ urls }) };
Expand Down
6 changes: 5 additions & 1 deletion libs/blocks/video/video.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ video {
justify-content: center;
align-items: center;
border-radius: 50%;
z-index: 2;
z-index: 3;
padding: 3px;
cursor: pointer;
}
Expand Down Expand Up @@ -131,6 +131,10 @@ video {
height: fit-content;
}

:is(.media .background, .hero-marquee.asset-left .foreground-media) .video-container {
width: 100%;
}

@media (min-width: 600px) {
.media:not(.media-reverse-mobile, .media-reversed) .video-container .pause-play-wrapper,
:is(.marquee.row-reversed .asset, .marquee-anchors, .hero-marquee.asset-left) .video-container .pause-play-wrapper,
Expand Down
9 changes: 9 additions & 0 deletions libs/deps/mas/mas.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions libs/deps/mas/merch-card.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Large diffs are not rendered by default.

Loading
Loading