From 2d5b5bfb7b0590b3b08656fc169473ee606269f2 Mon Sep 17 00:00:00 2001 From: Sean Choi Date: Tue, 14 Jan 2025 02:15:41 -0700 Subject: [PATCH 1/3] Setting aria-live to shadowRoot element instead to the slot. (#3389) * Setting aria-live to shadowRoot element instead to the slot. * Update unit test. * Adding escape in case there is no resultText. * Moving the aria-live code to mas --- libs/blocks/merch-card-collection/merch-card-collection.js | 4 +--- libs/deps/mas/merch-card-collection.js | 2 +- libs/features/mas/src/merch-card-collection.js | 2 +- .../merch-card-collection/mocks/merch-card-collection.html | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/blocks/merch-card-collection/merch-card-collection.js b/libs/blocks/merch-card-collection/merch-card-collection.js index cf791efd57..c7311b6a98 100644 --- a/libs/blocks/merch-card-collection/merch-card-collection.js +++ b/libs/blocks/merch-card-collection/merch-card-collection.js @@ -304,9 +304,6 @@ export default async function init(el) { literalEl.remove(); if (slot) { slot.setAttribute('slot', LITERAL_SLOTS[index]); - if (LITERAL_SLOTS[index].toLowerCase().includes('result')) { - slot.setAttribute('aria-live', 'polite'); - } index += 1; } literalSlots.push(slot); @@ -343,5 +340,6 @@ export default async function init(el) { 'merch-card-collection-render', 'merch-card-collection-render:start', ); + return merchCardCollection; } diff --git a/libs/deps/mas/merch-card-collection.js b/libs/deps/mas/merch-card-collection.js index 9e15747f60..db29fc71f6 100644 --- a/libs/deps/mas/merch-card-collection.js +++ b/libs/deps/mas/merch-card-collection.js @@ -103,7 +103,7 @@ var N=Object.defineProperty;var y=(s,e,t)=>e in s?N(s,e,{enumerable:!0,configura ${this.searchBar} ${this.filtersButton} ${this.sortButton} -
+
${this.displayResult?l``:""}
`}get footer(){if(!this.filtered)return l` -
+
${this.displayResult ? html`` : ''} diff --git a/test/blocks/merch-card-collection/mocks/merch-card-collection.html b/test/blocks/merch-card-collection/mocks/merch-card-collection.html index d70b04ef11..34c7eb0ef2 100644 --- a/test/blocks/merch-card-collection/mocks/merch-card-collection.html +++ b/test/blocks/merch-card-collection/mocks/merch-card-collection.html @@ -188,7 +188,7 @@
-

Search all products

Filters

Sort

Popularity

Alphabetical

0 results

1 result in

results in

1 result for

results for

1 result for:

results for:

Your search for did not yield any results

Your search for did not yield any results. Try a different search term.

Suggestions:

    +

    Search all products

    Filters

    Sort

    Popularity

    Alphabetical

    0 results

    1 result in

    results in

    1 result for

    results for

    1 result for:

    results for:

    Your search for did not yield any results

    Your search for did not yield any results. Try a different search term.

    Suggestions:

    • Make sure all words are spelled correctly
    • Use quotes to search for an entire phrase, such as "crop an image"

    Show more

    From c58ef7dff2d53a1d53e516394f54d0a0d3a1b657 Mon Sep 17 00:00:00 2001 From: Cody Lloyd <119891065+colloyd@users.noreply.github.com> Date: Tue, 14 Jan 2025 02:15:48 -0700 Subject: [PATCH 2/3] List accessibility for quiz-marquee (#3460) * List accessibility for quiz-marquee * Update quiz-marquee authoring to denote nested lists * roles for list and listitem in quiz-marquee and quiz-results Resolves: [MWPW-165027](https://jira.corp.adobe.com/browse/165027-NUMBER) * PR feedback --- libs/blocks/quiz-marquee/quiz-marquee.js | 6 +++++- libs/blocks/quiz-results/quiz-results.js | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/blocks/quiz-marquee/quiz-marquee.js b/libs/blocks/quiz-marquee/quiz-marquee.js index 70b82eade8..f98d1a9f33 100644 --- a/libs/blocks/quiz-marquee/quiz-marquee.js +++ b/libs/blocks/quiz-marquee/quiz-marquee.js @@ -68,9 +68,13 @@ export default async function init(el) { [...rows].forEach(async (row) => { const cols = row.querySelectorAll(':scope > div'); const isFragRow = cols[0].textContent.trim() === 'nested-fragments'; + const isList = cols[2]?.textContent?.trim() === 'list' || false; if (isFragRow) { - cols[0].parentElement.classList.add('nested', cols[1].textContent.trim()); + const fragParent = cols[0].parentElement; + fragParent?.classList.add('nested', cols[1]?.textContent?.trim()); + if (isList) fragParent.setAttribute('role', 'list'); + const wrapper = createTag('div', { class: 'copy-wrapper' }); row.append(wrapper); wrapper.append(...cols); diff --git a/libs/blocks/quiz-results/quiz-results.js b/libs/blocks/quiz-results/quiz-results.js index 7c9622366a..c4577ddea8 100644 --- a/libs/blocks/quiz-results/quiz-results.js +++ b/libs/blocks/quiz-results/quiz-results.js @@ -16,6 +16,7 @@ async function loadFragments(el, experiences) { } document.querySelectorAll('main > div, .quiz-results').forEach((quiz) => quiz.removeAttribute('daa-lh')); document.querySelectorAll('.quiz-results.basic > .fragment > .section').forEach((section, idx) => decorateSectionAnalytics(section, idx, getConfig())); + if (el.getAttribute('role') === 'list') document.querySelectorAll('.nested[role=list] > .fragment').forEach((fragment) => fragment.setAttribute('role', 'listitem')); } function redirectPage(quizUrl, debug, message) { From 95d3ce2ea922108f0e560ffd73a69ecd72c545e6 Mon Sep 17 00:00:00 2001 From: Nicolas Peltier <1032754+npeltier@users.noreply.github.com> Date: Tue, 14 Jan 2025 14:14:12 +0100 Subject: [PATCH 3/3] fixing unit test (#3480) --- .../merch-card-collection/mocks/merch-card-collection.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/blocks/merch-card-collection/mocks/merch-card-collection.html b/test/blocks/merch-card-collection/mocks/merch-card-collection.html index 34c7eb0ef2..a91179b98d 100644 --- a/test/blocks/merch-card-collection/mocks/merch-card-collection.html +++ b/test/blocks/merch-card-collection/mocks/merch-card-collection.html @@ -224,7 +224,7 @@
-

Search all products

Filters

Sort

Popularity

Alphabetical

0 results

1 result in

results in

1 result for

results for

1 result for:

results for:

Your search for did not yield any results

Your search for did not yield any results. Try a different search term.

Suggestions:

    +

    Search all products

    Filters

    Sort

    Popularity

    Alphabetical

    0 results

    1 result in

    results in

    1 result for

    results for

    1 result for:

    results for:

    Your search for did not yield any results

    Your search for did not yield any results. Try a different search term.

    Suggestions:

    • Make sure all words are spelled correctly
    • Use quotes to search for an entire phrase, such as "crop an image"

    Show more

    @@ -262,7 +262,7 @@
-

Search all products

Filters

Sort

Popularity

Alphabetical

0 results

1 result in

results in

1 result for

results for

1 result for:

results for:

Your search for did not yield any results

Your search for did not yield any results. Try a different search term.

Suggestions:

    +

    Search all products

    Filters

    Sort

    Popularity

    Alphabetical

    0 results

    1 result in

    results in

    1 result for

    results for

    1 result for:

    results for:

    Your search for did not yield any results

    Your search for did not yield any results. Try a different search term.

    Suggestions:

    • Make sure all words are spelled correctly
    • Use quotes to search for an entire phrase, such as "crop an image"

    Show more