Skip to content

Commit bd89ec9

Browse files
committed
Various ARIA fixes
1 parent b25717e commit bd89ec9

14 files changed

Lines changed: 331 additions & 714 deletions

File tree

axe-results-incomplete.json

Lines changed: 0 additions & 437 deletions
Large diffs are not rendered by default.

axe-results-violations.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
[]

src/components/CallToAction/Newsletter/layouts/article.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const buttonText = 'Subscribe'
4040
id="newsletter-email"
4141
name="email"
4242
placeholder={placeholder}
43+
aria-label="Email address"
4344
class="flex-1 px-3 py-2 bg-page-base/10 border border-page-base/20 rounded text-page-base text-sm placeholder:text-page-base/40 focus:outline-none focus-visible:outline-none"
4445
required
4546
aria-describedby="newsletter-message"

src/components/CallToAction/Newsletter/layouts/home.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ const buttonText = 'Subscribe'
113113
id="newsletter-email"
114114
name="email"
115115
placeholder={placeholder}
116+
aria-label="Work Email"
116117
class="w-full px-4 py-3 border border-trim rounded-lg bg-page-offset text-sm focus:outline-none focus-visible:outline-none transition-colors"
117118
required
118119
aria-describedby="newsletter-message"

src/components/CallToAction/Newsletter/layouts/page.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const buttonText = 'Subscribe'
4949
id="newsletter-email"
5050
name="email"
5151
placeholder={placeholder}
52+
aria-label="Work Email"
5253
class="w-full px-4 py-3 border border-trim rounded-lg bg-page-offset text-sm focus:outline-none focus-visible:outline-none transition-colors"
5354
required
5455
aria-describedby="newsletter-message"

src/components/Pages/Newsletter/Confirm/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ const { token } = Astro.props
192192
size={10}
193193
/>
194194
</div>
195-
<h2 class="text-2xl sm:text-3xl font-bold text-danger" id="error-title" tabindex="-1">
195+
<h1 class="text-2xl sm:text-3xl font-bold text-danger" id="error-title" tabindex="-1">
196196
Confirmation Error
197-
</h2>
197+
</h1>
198198
</div>
199199
<div class="px-6 py-8">
200200
<p class="text-lg text-content-active text-center mb-6" id="error-message">

src/components/Test/Demo.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
*/
66
---
77

8-
And a [link](/about) to included text.
8+
And a [link to the About page](/about) in included text.

src/content/articles/demo/index.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2512,6 +2512,10 @@ Download PDF files
25122512
text: "Download-ready reference material",
25132513
},
25142514
]}
2515+
secondaryLink={{
2516+
href: "/services/consulting",
2517+
text: "View consulting services",
2518+
}}
25152519
/>
25162520
```
25172521

@@ -2533,6 +2537,10 @@ Download PDF files
25332537
text: "Download-ready reference material",
25342538
},
25352539
]}
2540+
secondaryLink={{
2541+
href: "/services/consulting",
2542+
text: "View consulting services",
2543+
}}
25362544
/>
25372545

25382546
### Newsletter Signup Component

test/e2e/helpers/runAcrossPages.ts

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import { BasePage, test } from '@test/e2e/helpers'
2+
3+
const pages = [
4+
'/',
5+
'/about',
6+
'/articles',
7+
'/articles/demo',
8+
'/case-studies',
9+
'/consent',
10+
'/contact',
11+
'/my-data',
12+
'/newsletter',
13+
'/newsletter/confirm/error-token',
14+
'/newsletter/confirm/expired-token',
15+
'/newsletter/confirm/success',
16+
'/offline',
17+
'/privacy',
18+
'/search',
19+
'/services',
20+
'/terms',
21+
'/404',
22+
]
23+
24+
const pagesWithForms = [
25+
'/',
26+
'/articles/demo',
27+
'/consent',
28+
'/contact',
29+
'/privacy/my-data',
30+
'/newsletter',
31+
'/search',
32+
]
33+
34+
interface PageLoopDiagnostics {
35+
currentUrl: string
36+
pathname: string
37+
readyState: string
38+
title: string
39+
}
40+
41+
const getPageLoopDiagnostics = async (page: BasePage): Promise<PageLoopDiagnostics> => {
42+
if (page.page.isClosed()) {
43+
return {
44+
currentUrl: 'page-closed',
45+
pathname: 'unavailable',
46+
readyState: 'unavailable',
47+
title: 'unavailable',
48+
}
49+
}
50+
51+
const currentUrl = page.page.url()
52+
53+
const metadata = await page.evaluate(() => {
54+
return {
55+
pathname: window.location.pathname,
56+
readyState: document.readyState,
57+
title: document.title || '',
58+
}
59+
}).catch(() => {
60+
return {
61+
pathname: 'unavailable',
62+
readyState: 'unavailable',
63+
title: 'unavailable',
64+
}
65+
})
66+
67+
return {
68+
currentUrl,
69+
pathname: metadata.pathname,
70+
readyState: metadata.readyState,
71+
title: metadata.title,
72+
}
73+
}
74+
75+
const wrapPageLoopError = async (
76+
page: BasePage,
77+
url: string,
78+
error: unknown,
79+
formPagesOnly = false
80+
) => {
81+
const diagnostics = await getPageLoopDiagnostics(page)
82+
const message = error instanceof Error ? error.message : String(error)
83+
84+
throw new Error(
85+
[
86+
`Looped accessibility check failed on ${url}.`,
87+
`pageSet=${formPagesOnly ? 'pagesWithForms' : 'pages'}`,
88+
`currentUrl=${diagnostics.currentUrl}`,
89+
`pathname=${diagnostics.pathname}`,
90+
`title="${diagnostics.title}"`,
91+
`readyState=${diagnostics.readyState}`,
92+
`originalError=${message}`,
93+
].join(' '),
94+
{ cause: error instanceof Error ? error : undefined }
95+
)
96+
}
97+
98+
export const runAcrossPages = async (
99+
page: BasePage,
100+
label: string,
101+
callback: (_url: string) => Promise<void>,
102+
formPagesOnly = false
103+
) => {
104+
const loopPages = formPagesOnly ? pagesWithForms : pages
105+
106+
for (const url of loopPages) {
107+
await test.step(`${label} on ${url}`, async () => {
108+
try {
109+
await callback(url)
110+
} catch (error) {
111+
await wrapPageLoopError(page, url, error, formPagesOnly)
112+
}
113+
})
114+
}
115+
}

test/e2e/specs/11-accessibility/_pages.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)