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

MWPW-162956: Setting accessibleLabel as sr-only #3738

Open
wants to merge 4 commits into
base: stage
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions libs/deps/mas/commerce.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.

84 changes: 42 additions & 42 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.

126 changes: 63 additions & 63 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.

84 changes: 42 additions & 42 deletions libs/features/mas/dist/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.

28 changes: 4 additions & 24 deletions libs/features/mas/src/price/template.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.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const defaultLiterals = {
taxInclusiveLabel:
'{taxTerm, select, GST {incl. GST} VAT {incl. VAT} TAX {incl. tax} IVA {incl. IVA} SST {incl. SST} KDV {incl. KDV} other {}}',
alternativePriceAriaLabel: 'Alternatively at {alternativePrice}',
strikethroughAriaLabel: 'Regularly at {strikethroughPrice}',
strikethroughAriaLabel: 'Regularly at',
};

const log = createLog('ConsonantTemplates/price');
Expand Down Expand Up @@ -137,10 +137,9 @@ function renderContainer(
true,
);

return renderSpan(cssClass, markup, {
return `${accessibleLabel ? `<sr-only>${accessibleLabel}</sr-only>` : ''}${renderSpan(cssClass, markup, {
...attributes,
['aria-label']: accessibleLabel,
});
})}`;
}

/**
Expand Down Expand Up @@ -242,19 +241,10 @@ const createPriceTemplate =
usePrecision,
});

let accessibleLabel = accessiblePrice;
let accessibleLabel = '';

let recurrenceLabel = '';
if (toBoolean(displayRecurrence) && recurrenceTerm) {
const recurrenceAccessibleLabel = formatLiteral(
literalKeys.recurrenceAriaLabel,
{
recurrenceTerm,
},
);
if (recurrenceAccessibleLabel) {
accessibleLabel += ' ' + recurrenceAccessibleLabel;
}
recurrenceLabel = formatLiteral(literalKeys.recurrenceLabel, {
recurrenceTerm,
});
Expand All @@ -265,13 +255,6 @@ const createPriceTemplate =
perUnitLabel = formatLiteral(literalKeys.perUnitLabel, {
perUnit: 'LICENSE',
});
const perUnitAriaLabel = formatLiteral(
literalKeys.perUnitAriaLabel,
{ perUnit: 'LICENSE' },
);
if (perUnitAriaLabel) {
accessibleLabel += ' ' + perUnitAriaLabel;
}
}

let taxInclusivityLabel = '';
Expand All @@ -282,9 +265,6 @@ const createPriceTemplate =
: literalKeys.taxInclusiveLabel,
{ taxTerm },
);
if (taxInclusivityLabel) {
accessibleLabel += ' ' + taxInclusivityLabel;
}
}

if (displayStrikethrough) {
Expand Down
2 changes: 1 addition & 1 deletion libs/styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ header.global-navigation + .feds-localnav {
height: var(--global-height-navPromo);
}

.feds-sr-only {
sr-only, .feds-sr-only {
position: absolute;
width: 1px;
height: 1px;
Expand Down
Loading