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

feat(a11y): improve My Account payment-details/address-book components readability support #19451

Merged
merged 11 commits into from
Nov 5, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class CheckoutDeliveryAddressComponent implements OnInit {
const isSelected: boolean = selected && selected.id === address.id;

return {
role: 'region',
role: 'application',
title: address.defaultAddress ? textDefaultDeliveryAddress : '',
textBold: address.firstName + ' ' + address.lastName,
text: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export class CheckoutPaymentMethodComponent implements OnInit, OnDestroy {
const isSelected = selected?.id === paymentDetails.id;

return {
role: 'region',
role: 'application',
title: paymentDetails.defaultPayment
? cardLabels.textDefaultPaymentMethod
: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class AddressBookComponent implements OnInit {
const numbers = getAddressNumbers(address, textPhone, textMobile);

return {
role: 'region',
role: 'application',
textBold: address.firstName + ' ' + address.lastName,
text: [
address.line1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class PaymentMethodsComponent implements OnInit {
}
actions.push({ name: textDelete, event: 'edit' });
const card: Card = {
role: 'region',
role: 'application',
header: defaultPayment ? textDefaultPaymentMethod : undefined,
textBold: accountHolderName,
text: [cardNumber ?? '', textExpires],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[attr.aria-label]="
content.label ? (content.label | cxTranslate: { number: this.index }) : null
"
[attr.aria-describedby]="ariaDescribedBy"
[class.cx-card-border]="border"
[class.cx-card-fit-to-container]="fitToContainer"
>
Expand All @@ -28,7 +29,7 @@
{{ content.title }}
</span>
<!-- Card Content -->
<div class="cx-card-container">
<div class="cx-card-container" [id]="ariaDescribedBy">
<!-- Card Label -->
<div class="cx-card-label-container">
<div *ngIf="content.textBold" class="cx-card-label-bold">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,8 @@ export class CardComponent implements OnInit {
ngOnInit() {
// Intentional empty method
}

protected get ariaDescribedBy() {
return `cx-card-container-${this.index}`;
}
}
Loading