Skip to content

Commit

Permalink
Set aria-label for checkout links on 3 tier landing page (#6779)
Browse files Browse the repository at this point in the history
The actual text on these links reads "Support" in every case, with the
meaning coming from the context of the card. To make this clearer for
screen readers set the aria-text to the product name/label.

Also add aria-label to the support once button.
  • Loading branch information
tjmw authored Feb 14, 2025
1 parent b06b369 commit 3b0220d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions support-e2e/tests/smoke/promo-codes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { setTestUserRequiredDetails } from '../utils/testUserDetails';
expectedCheckoutTotalText: 'Was £12, now £9.60/month',
expectedThankYouText:
/You'll pay £(\d|\.)+\/month for the first (\d|\.)+ months, then £(\d|\.)+\/month afterwards unless you cancel\./,
accessibleCtaText: 'All-access digital',
},
{
tier: 2,
Expand All @@ -31,6 +32,7 @@ import { setTestUserRequiredDetails } from '../utils/testUserDetails';
expectedCheckoutTotalText: /Was £(\d|\.)+, now £(\d|\.)+\/year/i,
expectedThankYouText:
/You'll pay £(\d|\.)+\/year for the first year, then £(\d|\.)+\/year afterwards unless you cancel\./i,
accessibleCtaText: 'All-access digital',
},
].forEach((testDetails) => {
test(`${testDetails.expectedCardHeading} ${testDetails.frequency} ${testDetails.promoCode}`, async ({
Expand All @@ -42,7 +44,6 @@ import { setTestUserRequiredDetails } from '../utils/testUserDetails';
const testFirstName = firstName();
const testLastName = lastName();
const testEmail = email();
const ctaCopy = 'Support';

await setupPage(
page,
Expand All @@ -60,8 +61,7 @@ import { setTestUserRequiredDetails } from '../utils/testUserDetails';
card.getByText(testDetails.expectedPromoText).first(),
).toBeVisible();
await page
.getByRole('link', { name: ctaCopy })
.nth(testDetails.tier - 1)
.getByRole('link', { name: testDetails.accessibleCtaText })
.click();

// Checkout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export function SupportOnce({
);
}}
data-qm-trackable="support-once-button"
aria-label="Support once"
>
Support now
</LinkButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ export function ThreeTierCard({
href={link}
cssOverrides={btnStyleOverrides}
data-qm-trackable={quantumMetricButtonRef}
aria-label={label}
>
{ctaCopy}
</LinkButton>
Expand Down

0 comments on commit 3b0220d

Please sign in to comment.