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 #3315

Merged
merged 13 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc-code-compatibility.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 by default. Use a negated ignore pattern (like "--ignore-pattern '!<relative/path/to/filename>'") to override.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
],
ignorePatterns: [
'/libs/deps/*',
'/libs/navigation/dist/*',
'/tools/loc/*',
],
};
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ module.exports = {
'/libs/features/mas/*',
'/tools/loc/*',
'/libs/features/spectrum-web-components/*',
'/libs/navigation/dist/*',
],
plugins: [
'chai-friendly',
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/release-standalone-feds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Create a Release for Standalone Feds GlobalNav and Footer
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
type: string

permissions:
contents: write

jobs:
release-feds:
name: Release Standalone Feds
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
defaults:
run:
working-directory: ./libs/navigation
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm install

- name: Build Files
run: node ./build.mjs

- name: Generate tarball
run: npm pack

- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "feds-standalone-v${{ inputs.version }}" \
--repo="$GITHUB_REPOSITORY" \
--title="@adobecom/standalone-feds v${{ inputs.version }} Release" \
--generate-notes
- name: Upload Files to Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload "feds-standalone-v${{ inputs.version }}" "adobecom-standalone-feds-${{ inputs.version }}.tgz"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ logs/*
test-html-results/
test-results/
test-a11y-results/
libs/navigation/dist/
2 changes: 1 addition & 1 deletion libs/blocks/article-feed/article-feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
dropdown.setAttribute('aria-labelledby', `${type}-filter-button`);
dropdown.setAttribute('role', 'menu');

const SEARCH_ICON = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" focusable="false">
const SEARCH_ICON = `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" focusable="false">

Check warning on line 306 in libs/blocks/article-feed/article-feed.js

View check run for this annotation

Codecov / codecov/patch

libs/blocks/article-feed/article-feed.js#L306

Added line #L306 was not covered by tests
<path d="M14 2A8 8 0 0 0 7.4 14.5L2.4 19.4a1.5 1.5 0 0 0 2.1 2.1L9.5 16.6A8 8 0 1 0 14 2Zm0 14.1A6.1 6.1 0 1 1 20.1 10 6.1 6.1 0 0 1 14 16.1Z"></path>
</svg>`;
const searchBar = createTag('div', { class: 'filter-search' });
Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/aside/aside.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const blockConfig = {
},
};
const FORMAT_REGEX = /^format:/i;
const closeSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
const closeSvg = `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
<g transform="translate(-10500 3403)">
<circle cx="10" cy="10" r="10" transform="translate(10500 -3403)" fill="#707070"></circle>
<line y1="8" x2="8" transform="translate(10506 -3397)" fill="none" stroke="#fff" stroke-width="2"></line>
Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/chart/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ const init = (el) => {
const number = data?.number;
const [fontSize, titleY, subtitleY] = getOversizedNumberSize(number?.length);

const html = `<svg viewBox="0 0 430 430">
const html = `<svg aria-hidden="true" viewBox="0 0 430 430">
<circle cx="50%" cy="50%" r="50%" fill="${colorPalette[authoredColor]}" />
<text x="50%" y="${titleY}%" class="number" font-size="${fontSize}px">${number}</text>
<text x="50%" y="${subtitleY}%" class="subtitle">${data?.subtitle}</text>
Expand Down
4 changes: 2 additions & 2 deletions libs/blocks/footer/footer.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] <no-console> reported by reviewdog 🐶
Unexpected console statement.

console.log(`Could not create footer: ${error}`);

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [eslint] <no-console> reported by reviewdog 🐶
Unexpected console statement.

console.log('Could not create footer.');

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { getSVGsfromFile } from '../share/share.js';
const { miloLibs, codeRoot, locale } = getConfig();
const base = miloLibs || codeRoot;

const GLOBE_IMG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" focusable="false" class="footer-region-img" loading="lazy" alt="wireframe globe"><path d="M50 23.8c-0.2-3.3-1-6.5-2.4-9.5l0 0C43.7 5.9 35.4 0.4 26.2 0h-2.4C14.6 0.4 6.3 5.9 2.4 14.3l0 0c-1.4 3-2.2 6.2-2.4 9.5l0 0v2.4l0 0c0.2 3.3 1 6.5 2.4 9.5l0 0c4 8.4 12.2 13.9 21.4 14.3h2.4c9.2-0.4 17.5-5.9 21.4-14.3l0 0c1.4-3 2.2-6.2 2.4-9.5l0 0V23.8zM47.6 23.8h-9.5c0-3.2-0.4-6.4-1.2-9.5H45C46.6 17.2 47.5 20.5 47.6 23.8zM33.6 11.9h-7.4V2.6C29.3 3.3 31.9 7.1 33.6 11.9zM23.8 2.6v9.3h-7.4C18.1 7.1 20.7 3.3 23.8 2.6zM23.8 14.3v9.5h-9.5c0.1-3.2 0.6-6.4 1.4-9.5H23.8zM23.8 26.2v9.5h-8.1c-0.8-3.1-1.3-6.3-1.4-9.5H23.8zM23.8 38.1v9.3c-3.1-0.7-5.7-4.5-7.4-9.3H23.8zM26.2 47.4v-9.3h7.4C31.9 42.9 29.3 46.7 26.2 47.4zM26.2 35.7v-9.5h9.5c-0.1 3.2-0.6 6.4-1.4 9.5H26.2zM26.2 23.8v-9.5h8.1c0.8 3.1 1.3 6.3 1.4 9.5H26.2zM43.3 11.9h-7.1c-0.9-3.1-2.4-6.1-4.5-8.6C36.4 4.8 40.5 7.8 43.3 11.9zM18.6 3.3c-2.2 2.5-3.8 5.4-4.8 8.6H6.7C9.6 7.8 13.8 4.8 18.6 3.3zM5 14.3h8.1c-0.7 3.1-1.1 6.3-1.2 9.5H2.4C2.5 20.5 3.4 17.2 5 14.3zM2.4 26.2h9.5c0 3.2 0.4 6.4 1.2 9.5H5C3.4 32.8 2.5 29.5 2.4 26.2zM6.4 38.1h7.4c0.9 3.1 2.4 6.1 4.5 8.6 -4.7-1.5-8.8-4.5-11.7-8.6H6.4zM31.4 46.7c2.2-2.5 3.8-5.4 4.8-8.6h7.4C40.6 42.2 36.3 45.3 31.4 46.7zM45 35.7h-8.1c0.7-3.1 1.1-6.3 1.2-9.5h9.5C47.5 29.5 46.6 32.8 45 35.7z"></path></svg>';
const SPECTRUM_CHEVRON = '<svg class="icon-chevron-down" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.spectrum-chevron-down{fill:none;stroke-linecap:round;stroke-linejoin:round;}</style></defs><path stroke="currentColor" class="spectrum-chevron-down" d="M3.47,5.74l4.53,4.53,4.54-4.53"/></svg>';
const GLOBE_IMG = '<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" focusable="false" class="footer-region-img" loading="lazy"><path d="M50 23.8c-0.2-3.3-1-6.5-2.4-9.5l0 0C43.7 5.9 35.4 0.4 26.2 0h-2.4C14.6 0.4 6.3 5.9 2.4 14.3l0 0c-1.4 3-2.2 6.2-2.4 9.5l0 0v2.4l0 0c0.2 3.3 1 6.5 2.4 9.5l0 0c4 8.4 12.2 13.9 21.4 14.3h2.4c9.2-0.4 17.5-5.9 21.4-14.3l0 0c1.4-3 2.2-6.2 2.4-9.5l0 0V23.8zM47.6 23.8h-9.5c0-3.2-0.4-6.4-1.2-9.5H45C46.6 17.2 47.5 20.5 47.6 23.8zM33.6 11.9h-7.4V2.6C29.3 3.3 31.9 7.1 33.6 11.9zM23.8 2.6v9.3h-7.4C18.1 7.1 20.7 3.3 23.8 2.6zM23.8 14.3v9.5h-9.5c0.1-3.2 0.6-6.4 1.4-9.5H23.8zM23.8 26.2v9.5h-8.1c-0.8-3.1-1.3-6.3-1.4-9.5H23.8zM23.8 38.1v9.3c-3.1-0.7-5.7-4.5-7.4-9.3H23.8zM26.2 47.4v-9.3h7.4C31.9 42.9 29.3 46.7 26.2 47.4zM26.2 35.7v-9.5h9.5c-0.1 3.2-0.6 6.4-1.4 9.5H26.2zM26.2 23.8v-9.5h8.1c0.8 3.1 1.3 6.3 1.4 9.5H26.2zM43.3 11.9h-7.1c-0.9-3.1-2.4-6.1-4.5-8.6C36.4 4.8 40.5 7.8 43.3 11.9zM18.6 3.3c-2.2 2.5-3.8 5.4-4.8 8.6H6.7C9.6 7.8 13.8 4.8 18.6 3.3zM5 14.3h8.1c-0.7 3.1-1.1 6.3-1.2 9.5H2.4C2.5 20.5 3.4 17.2 5 14.3zM2.4 26.2h9.5c0 3.2 0.4 6.4 1.2 9.5H5C3.4 32.8 2.5 29.5 2.4 26.2zM6.4 38.1h7.4c0.9 3.1 2.4 6.1 4.5 8.6 -4.7-1.5-8.8-4.5-11.7-8.6H6.4zM31.4 46.7c2.2-2.5 3.8-5.4 4.8-8.6h7.4C40.6 42.2 36.3 45.3 31.4 46.7zM45 35.7h-8.1c0.7-3.1 1.1-6.3 1.2-9.5h9.5C47.5 29.5 46.6 32.8 45 35.7z"></path></svg>';
const SPECTRUM_CHEVRON = '<svg aria-hidden="true" class="icon-chevron-down" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.spectrum-chevron-down{fill:none;stroke-linecap:round;stroke-linejoin:round;}</style></defs><path stroke="currentColor" class="spectrum-chevron-down" d="M3.47,5.74l4.53,4.53,4.54-4.53"/></svg>';
const ADCHOICE_IMG = `<img class="footer-link-img" loading="lazy" alt="AdChoices icon" src="${base}/blocks/footer/adchoices-small.svg" height="9" width="9">`;
const SUPPORTED_SOCIAL = ['facebook', 'instagram', 'twitter', 'linkedin', 'pinterest', 'discord', 'behance', 'youtube', 'weibo', 'social-media'];

Expand Down
14 changes: 14 additions & 0 deletions libs/blocks/global-footer/global-footer.css
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,20 @@
height: 12px;
}

@media (min-width: 600px) {
dialog.feds-dialog {
max-width: 80vw;
width: fit-content;
}
}

@media (min-width: 1200px) {
dialog.feds-dialog {
width: 1200px;
max-width: calc((100% - 6px) - 2em);
}
}

@media (min-width: 900px) {
/* If there is too much content, float it on multiple rows */
.feds-footer-wrapper .feds-menu-content {
Expand Down
45 changes: 36 additions & 9 deletions libs/blocks/global-footer/global-footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
decorateLinks,
getMetadata,
getConfig,
loadBlock,
localizeLink,
loadStyle,
} from '../../utils/utils.js';

import {
Expand Down Expand Up @@ -212,11 +212,13 @@ class Footer {
aria-expanded="false"
aria-haspopup="true"
role="button">
<svg xmlns="http://www.w3.org/2000/svg" class="feds-regionPicker-globe" focusable="false">
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" class="feds-regionPicker-globe" focusable="false">
<use href="#footer-icon-globe" />
</svg>
${regionPickerTextElem}
</a>`;
regionPickerElem.dataset.modalPath = `${url.pathname}#_inline`;
regionPickerElem.dataset.modalHash = url.hash;
const regionPickerWrapperClass = 'feds-regionPicker-wrapper';
this.elements.regionPicker = toFragment`<div class="${regionPickerWrapperClass}">
${regionPickerElem}
Expand All @@ -230,24 +232,48 @@ class Footer {
// Hash -> region selector opens a modal
decorateAutoBlock(regionPickerElem); // add modal-specific attributes
// TODO remove logs after finding the root cause for the region picker 404s -> MWPW-143627
regionPickerElem.href = url.hash;
if (regionPickerElem.classList[0] !== 'modal') {
lanaLog({
message: `Modal block class missing from region picker pre loading the block; locale: ${locale}; regionPickerElem: ${regionPickerElem.outerHTML}`,
tags: 'errorType=warn,module=global-footer',
});
}
await loadBlock(regionPickerElem); // load modal logic and styles
loadStyle(`${base}/blocks/modal/modal.css`);
const { default: initModal } = await import('../modal/modal.js');
const modal = await initModal(regionPickerElem);

const loadRegionNav = async () => {
const block = document.querySelector('.region-nav');
if (block && getConfig().standaloneGnav) {
// on standalone the region-nav will fail to load automatically through
// the modal calling fragment.js. In that case we will have data-failed=true
// and we should manually load region nav
// If that's not the case then we're not a standalone gnav
// and we mustn't load region-nav twice.
if (block.getAttribute('data-failed') !== 'true') return;
block.classList.add('hide');
loadStyle(`${base}/blocks/region-nav/region-nav.css`);
const { default: initRegionNav } = await import('../region-nav/region-nav.js');
initRegionNav(block);
// decoratePlaceholders(block, getConfig());
block.classList.remove('hide');
}
};

if (modal) await loadRegionNav(); // just in case the modal is already open

if (regionPickerElem.classList[0] !== 'modal') {
lanaLog({
message: `Modal block class missing from region picker post loading the block; locale: ${locale}; regionPickerElem: ${regionPickerElem.outerHTML}`,
tags: 'errorType=warn,module=global-footer',
});
}
// 'decorateAutoBlock' logic replaces class name entirely, need to add it back
regionPickerElem.classList.add(regionPickerClass);
regionPickerElem.addEventListener('click', () => {
if (!isRegionPickerExpanded()) {
regionPickerElem.setAttribute('aria-expanded', 'true');
// wait for the modal to load before we load the region nav
window.addEventListener('milo:modal:loaded', loadRegionNav, { once: true });
}
});
// Set aria-expanded to false when region modal is closed
Expand All @@ -262,7 +288,8 @@ class Footer {
regionSelector.href = localizeLink(regionSelector.href);
decorateAutoBlock(regionSelector); // add fragment-specific class(es)
this.elements.regionPicker.append(regionSelector); // add fragment after regionPickerElem
await loadBlock(regionSelector); // load fragment and replace original link
const { default: initFragment } = await import('../fragment/fragment.js');
await initFragment(regionSelector); // load fragment and replace original link
// Update aria-expanded on click
regionPickerElem.addEventListener('click', (e) => {
e.preventDefault();
Expand All @@ -278,7 +305,7 @@ class Footer {
});
}

return this.regionPicker;
return this.elements.regionPicker;
};

decorateSocial = () => {
Expand All @@ -301,7 +328,7 @@ class Footer {
aria-label="${platform}"
daa-ll="${getAnalyticsValue(platform, index + 1)}"
target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" class="feds-social-icon" alt="${platform} logo">
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" class="feds-social-icon">
<use href="#footer-icon-${platform}" />
</svg>
</a>
Expand Down Expand Up @@ -331,7 +358,7 @@ class Footer {

// Add Ad Choices icon
const adChoicesElem = privacyContent.querySelector('a[href*="#interest-based-ads"]');
adChoicesElem?.prepend(toFragment`<svg xmlns="http://www.w3.org/2000/svg" class="feds-adChoices-icon" focusable="false">
adChoicesElem?.prepend(toFragment`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" class="feds-adChoices-icon" focusable="false">
<use href="#footer-icon-adchoices" />
</svg>`);

Expand Down
4 changes: 2 additions & 2 deletions libs/blocks/global-navigation/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@
align-items: center;
}

header.global-navigation {
visibility: visible;
header.global-navigation.ready {
visibility: visible !important;
}

/* Desktop styles */
Expand Down
22 changes: 13 additions & 9 deletions libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint import/no-relative-packages: 0 */
/* eslint-disable no-async-promise-executor */
import {
getConfig,
Expand All @@ -20,7 +21,6 @@ import {
isTangentToViewport,
lanaLog,
loadBaseStyles,
loadBlock,
loadDecorateMenu,
rootPath,
loadStyles,
Expand Down Expand Up @@ -222,7 +222,7 @@ const decorateProfileTrigger = async ({ avatar }) => {
let keyboardNav;
const setupKeyboardNav = async () => {
keyboardNav = keyboardNav || new Promise(async (resolve) => {
const KeyboardNavigation = await loadBlock('./keyboard/index.js');
const { default: KeyboardNavigation } = await import('./utilities/keyboard/index.js');
const instance = new KeyboardNavigation();
resolve(instance);
});
Expand Down Expand Up @@ -372,6 +372,9 @@ class Gnav {
</div>`;

this.block.append(this.elements.curtain, this.elements.aside, this.elements.topnavWrapper);
// TODO: Remove with mobile redesign code
const firstLocalNavItem = this.elements.navWrapper.querySelector('.feds-nav .feds-navItem:not(.feds-navItem--section) a');
if (firstLocalNavItem) [firstLocalNavItem.textContent] = firstLocalNavItem.textContent.split('|');
};

addChangeEventListeners = () => {
Expand Down Expand Up @@ -425,17 +428,17 @@ class Gnav {
this.block.removeEventListener('keydown', this.loadDelayed);
if (this.searchPresent()) {
const [
Search,
{ default: Search },
] = await Promise.all([
loadBlock('../features/search/gnav-search.js'),
import('./features/search/gnav-search.js'),
loadStyles(rootPath('features/search/gnav-search.css')),
]);
this.Search = Search;
}

if (!this.useUniversalNav) {
const [ProfileDropdown] = await Promise.all([
loadBlock('../features/profile/dropdown.js'),
const [{ default: ProfileDropdown }] = await Promise.all([
import('./features/profile/dropdown.js'),
loadStyles(rootPath('features/profile/dropdown.css')),
]);
this.ProfileDropdown = ProfileDropdown;
Expand Down Expand Up @@ -540,7 +543,7 @@ class Gnav {
const unavVersion = new URLSearchParams(window.location.search).get('unavVersion') || '1.3';
await Promise.all([
loadScript(`https://${environment}.adobeccstatic.com/unav/${unavVersion}/UniversalNav.js`),
loadStyles(`https://${environment}.adobeccstatic.com/unav/${unavVersion}/UniversalNav.css`),
loadStyles(`https://${environment}.adobeccstatic.com/unav/${unavVersion}/UniversalNav.css`, true),
]);

const getChildren = () => {
Expand Down Expand Up @@ -910,7 +913,7 @@ class Gnav {

const menuLogic = await loadDecorateMenu();

menuLogic.decorateMenu({
await menuLogic.decorateMenu({
item,
template,
type: itemType,
Expand Down Expand Up @@ -1021,7 +1024,7 @@ class Gnav {
const breadcrumbsElem = this.block.querySelector('.breadcrumbs');
// Breadcrumbs are not initially part of the nav, need to decorate the links
if (breadcrumbsElem) decorateLinks(breadcrumbsElem);
const createBreadcrumbs = await loadBlock('../features/breadcrumbs/breadcrumbs.js');
const { default: createBreadcrumbs } = await import('./features/breadcrumbs/breadcrumbs.js');
this.elements.breadcrumbsWrapper = await createBreadcrumbs(breadcrumbsElem);
return this.elements.breadcrumbsWrapper;
};
Expand Down Expand Up @@ -1091,5 +1094,6 @@ export default async function init(block) {
const mepMartech = mep?.martech || '';
block.setAttribute('daa-lh', `gnav|${getExperienceName()}${mepMartech}`);
if (isDarkMode()) block.classList.add('feds--dark');
block.classList.add('ready');
return gnav;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint import/no-relative-packages: 0 */
/* eslint-disable camelcase */
import { getConfig } from '../../../utils/utils.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint import/no-relative-packages: 0 */
/* eslint-disable no-promise-executor-return, no-async-promise-executor */
import { getConfig } from '../../../utils/utils.js';

Expand Down
Loading
Loading