Skip to content

Commit 3820c51

Browse files
committed
* ensure that we don't run axe on pages we want to exclude
1 parent c902466 commit 3820c51

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

.github/workflows/axe.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,3 @@ jobs:
2323
- name: Run axe script
2424
run: |
2525
script/axe-docs
26-
- name: Upload @axe-core/cli check results
27-
uses: actions/upload-artifact@master
28-
with:
29-
path: docs-example-accessibility.json

script/axe-docs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@ parse_yaml() {
1919
}'
2020
}
2121

22-
# Find all nav paths for component pages
22+
# https://stackoverflow.com/a/8574392
23+
containsElement () {
24+
local e match="$1"
25+
shift
26+
for e; do [[ "$e" == "$match" ]] && return 0; done
27+
return 1
28+
}
29+
30+
# Find all paths for component pages
2331
nav_paths=($(parse_yaml docs/src/@primer/gatsby-theme-doctocat/nav.yml | grep "/components/" | awk -F "=" '{print $2}'))
2432

25-
# Exclude known violations
33+
# Starting point violations
2634
# DO NOT ADD TO THIS LIST
2735
needs_to_be_fixed=(
2836
/components/autocomplete
@@ -46,7 +54,7 @@ echo "############################################################"
4654
doc_urls=()
4755
for i in "${nav_paths[@]}";
4856
do
49-
if [[ " ${needs_to_be_fixed[*]} " =~ " ${i} " ]]; then
57+
if containsElement "${i//\"/}" "${needs_to_be_fixed[@]}"; then
5058
continue
5159
else
5260
doc_url="http://localhost:8000$i"
@@ -55,4 +63,5 @@ do
5563
fi
5664
done
5765

58-
axe ${doc_urls[@]} --include "iframe" --disable html-has-lang,frame-title,page-has-heading-one,region,color-contrast,landmark-unique,landmark-one-main --save docs-example-accessibility.json --exit --show-errors
66+
# We disable rules that depend on full page context.
67+
axe ${doc_urls[@]} --include "iframe" --disable html-has-lang,frame-title,page-has-heading-one,region,color-contrast,landmark-unique,landmark-one-main --exit --show-errors

0 commit comments

Comments
 (0)