Skip to content

Commit af9c7b9

Browse files
wandmagicdavid-waltermireaj-stein-gsa
authored
Feature/accessability (#267)
* fix syntax-highlight * minor global adjustments for better compliance * prefer design color tokens * 0 compliance errors * add compliance action * prefer design token colors * removed comments * improve pa11y config --------- Co-authored-by: David Waltermire <davewaltermire@gmail.com> Co-authored-by: A.J. Stein <alexander.stein@gsa.gov>
1 parent 3670c06 commit af9c7b9

File tree

20 files changed

+1036
-164
lines changed

20 files changed

+1036
-164
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Compliance Test
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
branches:
6+
- main
7+
- develop
8+
- "feature/*"
9+
- "release/*"
10+
11+
jobs:
12+
compliance-test:
13+
name: Run Compliance Tests
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- name: Checkout Latest
17+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
18+
with:
19+
submodules: recursive
20+
21+
# Install Hugo
22+
- name: Read .env
23+
id: hugo-version
24+
run: |
25+
. .github/workflows/config/.env
26+
echo "HUGO_VERSION=${HUGO_VERSION}" >> "${GITHUB_OUTPUT}"
27+
28+
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
29+
with:
30+
go-version: '1.21'
31+
32+
- name: Setup Hugo
33+
uses: peaceiris/actions-hugo@16361eb4acea8698b220b76c0d4e84e1fd22c61d
34+
with:
35+
hugo-version: '${{ steps.hugo-version.outputs.HUGO_VERSION }}'
36+
extended: true
37+
38+
- name: Set up NodeJS
39+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
40+
with:
41+
node-version-file: '.github/workflows/config/.nvmrc'
42+
cache: 'npm'
43+
cache-dependency-path: package-lock.json
44+
45+
- name: Install Chrome
46+
run: |
47+
echo "Installing Chrome..."
48+
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
49+
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
50+
sudo apt-get update
51+
sudo apt-get install -y google-chrome-stable
52+
google-chrome --version
53+
54+
- name: Install Dependencies
55+
run: |
56+
npm install --loglevel verbose
57+
58+
# Verify pa11y-ci installation
59+
echo "Checking pa11y-ci installation..."
60+
npx pa11y-ci --version
61+
which pa11y-ci || echo "pa11y-ci not in PATH"
62+
ls -la node_modules/.bin/pa11y-ci || echo "pa11y-ci not in node_modules/.bin"
63+
64+
# Start Hugo server in background and wait for it to be ready
65+
- name: Start Hugo Server
66+
run: |
67+
cd website
68+
hugo serve --bind 0.0.0.0 --baseURL http://localhost:1313/hugo-uswds/ &
69+
HUGO_PID=$!
70+
echo "Hugo server started with PID: $HUGO_PID"
71+
72+
# Check port binding
73+
echo "Checking network status..."
74+
netstat -tlpn
75+
76+
echo "Waiting for Hugo server to start..."
77+
78+
# Wait for up to 30 seconds for the server to be ready
79+
max_attempts=30
80+
attempt=1
81+
while ! curl -s --head http://localhost:1313/hugo-uswds/ > /dev/null; do
82+
if [ $attempt -gt $max_attempts ]; then
83+
echo "Server failed to start after $max_attempts seconds"
84+
exit 1
85+
fi
86+
echo "Attempt $attempt: Server not ready yet, waiting..."
87+
sleep 1
88+
attempt=$((attempt + 1))
89+
done
90+
91+
echo "Server is ready!"
92+
echo "Network status after server start:"
93+
netstat -tlpn
94+
echo "Testing server response:"
95+
curl -I http://localhost:1313/hugo-uswds/
96+
echo "Process status:"
97+
ps aux | grep hugo
98+
99+
# Run compliance tests with increased verbosity
100+
- name: Run Compliance Tests
101+
run: |
102+
# Verify sitemap is accessible
103+
echo "Testing sitemap access..."
104+
curl -v http://localhost:1313/hugo-uswds/sitemap.xml
105+
106+
echo "Running pa11y-ci tests with debug logging..."
107+
DEBUG=pa11y* CHROME_PATH=$(which google-chrome) npm run test:compliance

.github/workflows/workflow-generate-website.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
npm install --loglevel verbose
103103
echo "$PWD/node_modules/.bin/" >> $GITHUB_PATH
104104
# cache hugo modules
105-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2
105+
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
106106
with:
107107
path: /tmp/hugo_cache
108108
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
@@ -118,7 +118,7 @@ jobs:
118118
zip ${{ runner.temp }}/website.zip -r public/
119119
working-directory: ${{ github.workspace }}/website
120120
- name: Upload generated site
121-
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
121+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
122122
with:
123123
name: website
124124
path: |
@@ -137,7 +137,7 @@ jobs:
137137
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138138
continue-on-error: true
139139
- name: Upload link check report
140-
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
140+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
141141
with:
142142
name: html-link-report
143143
path: html-link-report.md

.pa11yci

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"defaults": {
3+
"timeout": 60000,
4+
"chromeLaunchConfig": {
5+
"args": [
6+
"--no-sandbox",
7+
"--disable-setuid-sandbox",
8+
"--headless",
9+
"--disable-gpu",
10+
"--disable-dev-shm-usage"
11+
]
12+
},
13+
"standard": "WCAG2AA"
14+
}
15+
}

dist/css/styles.css

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/css/styles.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/hugo-uswds.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/hugo-uswds.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

layouts/_default/baseof.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
{{- end -}}
5656

5757
{{- if ne .Kind "404" }}
58-
<p class="font-sans-sm text-center" style="margin: 1.5rem auto; clear: both;">This page was last updated on {{ .Lastmod.Format "January 2, 2006" }}.{{ if .Site.Params.contentrepopath }} <a href="{{ .Site.Params.contentrepopath }}/{{ with .File }}{{ .Path }}{{ end }}">Improve this Page.</a>{{ end }}</p>
58+
<footer>
59+
<p class="font-sans-sm text-center" style="margin: 1.5rem auto; clear: both;">This page was last updated on {{ .Lastmod.Format "January 2, 2006" }}.{{ if .Site.Params.contentrepopath }} <a href="{{ .Site.Params.contentrepopath }}/{{ with .File }}{{ .Path }}{{ end }}">Improve this Page.</a>{{ end }}</p>
60+
</footer>
5961
{{- end -}}
6062

6163
{{- range .Site.Params.custom_js }}

layouts/partials/components/usa-breadcrumb.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
{{- end -}}
2222

2323
<li class="{{ delimit $itemClasses " " }}">
24-
<a href="{{ $page.RelPermalink }}" class="{{ delimit $anchorClasses " " }}"{{ if eq $page $activePage }} aria-current="page"{{end}}><span>{{ $page.LinkTitle }}</span></a>
24+
<a href="{{ $page.RelPermalink }}" class="{{ delimit $anchorClasses " " }}"{{ if eq $page $activePage }} aria-current="page"{{end}}>{{ $page.LinkTitle }}</a>
2525
</li>
2626
{{- end -}}

layouts/partials/components/usa-header/primary-nav.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<button class="usa-accordion__button usa-nav__link{{ if $currentPage.HasMenuCurrent "primary" . }} usa-current{{ end }}"
88
type="button"
99
aria-expanded="false"
10-
aria-controls="{{ $guid }}"><span>{{ .Name }}</span></button>
10+
aria-controls="{{ $guid }}">{{ .Name }}</button>
1111
<ul id="{{ $guid }}" class="usa-nav__submenu">
1212
<li class="usa-nav__submenu-item">
1313
<a href="{{ .URL }}">{{ .Name }}</a>
@@ -21,7 +21,7 @@
2121
</li>
2222
{{ else }}
2323
<li class="usa-nav__primary-item">
24-
<a class="usa-nav__link" href="{{ .URL }}"><span>{{ .Name }}</span></a>
24+
<a class="usa-nav__link" href="{{ .URL }}">{{ .Name }}</a>
2525
</li>
2626
{{ end }}
2727
{{ end }}

0 commit comments

Comments
 (0)