44# Developers frequently copy and paste examples from documentation so it's important to ensure the examples are accessible.
55# Learn about @axe-core/cli: https://github.com/dequelabs/axe-core-npm/tree/develop/packages/cli
66
7- array=($MODIFIED_COMPONENT_OR_UTILITIES_PATHS )
8- printf " %s\n" " ${array[@]} " > temp.txt
7+ if [ ${# CHANGED_DOCS_PATH[@]} -eq 0 ]; then
8+ echo " CHANGED_DOCS_PATH must be set to run axe checks."
9+ exit
10+ fi
911
10- # Store the paths of pages we care about
12+ printf " %s\n " " ${CHANGED_DOCS_PATH[@]} " > temp.txt
1113nav_paths=()
1214while IFS= read -r file
1315do
1921done < temp.txt
2022rm temp.txt
2123
22- # Return early if no relevant files were modified
23- echo " Verify whether ${nav_paths[@]} is part of starting point violation"
24- echo " *"
25- echo " *"
26-
24+ echo $nav_paths
2725# https://stackoverflow.com/a/8574392
2826containsElement () {
2927 local e match=" $1 "
@@ -32,9 +30,9 @@ containsElement () {
3230 return 1
3331}
3432
35- # Starting point violations
33+ # Starting point violations list
3634# DO NOT ADD TO THIS LIST!
37- skipped =(
35+ needs_to_be_fixed =(
3836 /components/autocomplete
3937 /components/avatars
4038 /components/box
@@ -56,8 +54,8 @@ skipped=()
5654for i in " ${nav_paths[@]} " ;
5755do
5856 if containsElement " ${i// \" / } " " ${needs_to_be_fixed[@]} " ; then
57+ echo " Skipping $i "
5958 skipped+=($i )
60- continue
6159 else
6260 doc_url=" http://localhost:8000$i "
6361 doc_url=" ${doc_url// \" / } "
6664done
6765
6866if (( ${# skipped[@]} )) ; then
69- echo " ############################################################ "
67+ echo " =========================================================================================== "
7068 echo " WARNING"
71- echo " The following paths are excluded from axe checks because they are part of starting point violations:"
72- printf ' %s\n' " ${needs_to_be_fixed[@]} "
7369 echo " "
70+ echo " Oh no! We had to skip accessibility checks on:"
7471 echo " "
75- echo " While you're working in:"
7672 printf ' %s\n' " ${skipped[@]} "
77- echo " will you consider fixing the accessibility issues so we can remove it from the list? ❤️"
78- echo " ############################################################"
73+ echo " "
74+ echo " because they are part of the starting point violations list."
75+ echo " "
76+ echo " Help us get one closer to getting rid of this list!"
77+ echo " Consider addressing the accessibility issues on the examples of these pages as part of your PR ❤️"
78+ echo " ==========================================================================================="
7979fi
8080
8181# Run axe checks only if there are pages to run it on
0 commit comments