-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add accessibility checks for component documentation examples #2017
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
b50e32d to
97afe83
Compare
97afe83 to
b192a17
Compare
ba6516b to
e06d043
Compare
190aefc to
4a27fed
Compare
4a27fed to
e283ad7
Compare
a1da4fe to
8e3b4e1
Compare
ecae8ed to
dc23b54
Compare
|
I'm not familiar with |
|
Here is an example failure: https://github.com/primer/css/runs/5836513128?check_suite_focus=true. |
This reverts commit fc33214.
3c9ae5c to
76965e5
Compare
76965e5 to
191b02d
Compare
This reverts commit 191b02d.
2ad98c9 to
4a24aaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonrohan, @simurai This is ready for a hopefully final review :)
I updated things a bit after thinking through @simurai feedback!
Unlike PRC or PVC docs, Primer CSS doc examples don't have dependencies on external code since it's just HTML and CSS. CSS changes shouldn't affect HTML semantics so I think we only really need to run axe on URLs that correspond to doc files that were modified rather than on every doc page for every update.
Changes:
- Added this handy action which allows us to skip steps in the axe workflow based on pattern matching of changed files. This allowed us to get rid of some unpleasant parsing/conditional logic from our bash script.
- We only run axe checks on urls that correspond to doc paths that were modified which gets passed in from the Action in the former step.
Example run of when there are multiple modified files. We only run axe on 2 urls that correspond to paths that were changed. Time: 3 min 25s
Example run of axe action early returning because there were no changes to doc paths we cared about. Time: 9s
If we decide it is useful to run full axe checks for every doc page on every PR run, we can always revert back to: bd9eb4b.
| echo "===========================================================================================" | ||
| echo "WARNING" | ||
| echo "" | ||
| echo "Oh no! We have to skip accessibility checks on these doc pages you updated:" | ||
| echo "" | ||
| printf '%s\n' "${skipped[@]}" | ||
| echo "" | ||
| echo "because they are part of the starting point violations list." | ||
| echo "" | ||
| echo "Help us get one closer to getting rid of this list!" | ||
| echo "Consider addressing the accessibility issues on the examples of these pages as part of your PR ❤️" | ||
| echo "===========================================================================================" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love if we added this message as a comment to the PR as a future enhancement.
This will bring greater attention to the fact that axe check is being skipped on a doc page someone has updated.
| fetch-depth: 0 | ||
| - name: Get changed files | ||
| id: changed-files | ||
| uses: tj-actions/changed-files@v18.6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Learn more here: https://github.com/tj-actions/changed-files
| # This workflow runs axe checks on modified doc/content/components/* or doc/content/components/* pages because those include code examples. | ||
| # Developers frequently copy and paste examples directly so it's important to ensure the examples are accessible. | ||
| # Learn about @axe-core/cli: https://github.com/dequelabs/axe-core-npm/tree/develop/packages/cli | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This STRING_OF_PATHS_WE_CARE_ABOUT will be passed in by the previous step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the speed improvements. They sound great. 🏇
|
Anything else I should do to get this merged? 🙏 @primer/css-reviewers |
Fixes https://github.com/github/primer/issues/728
Looking into this as part of accessibility passion week ❤️
cc: @primer/accessibility
What are you trying to accomplish?
This PR introduces a GitHub Action workflow that conducts axe check on examples on the documentation site.
The script uses @axe-core/cli.
We run the documentation site and run axe checks on every
iframeon the components and utilities pages.We exclude rules that are dependent on full-page context as those don't make sense to check.
What approach did you choose and why?
needs_to_be_fixedlist which represents starting point violations. We should fix this over time.pa11y, which is a similar, alternate option.NOTE: the axe CLI will fail when called on a page without the specified element in
--include. This is why we limit it to/components/and/utilities/path which are guaranteed (as of now) to haveiframeelements we want to check.What should reviewers focus on?
This workflow takes around 5 minutes to complete. Is that acceptable? Thoughts appreciated.
Are additional changes needed?