Skip to content
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

GitHub Action: runs Axe accessibility tests on changed files #5

Closed
wants to merge 23 commits into from

Conversation

jcarstairs-scottlogic
Copy link
Collaborator

@jcarstairs-scottlogic jcarstairs-scottlogic commented Nov 27, 2023

This PR implements a GitHub Action to check for low-hanging accessibility problems in new blog posts. Here's an example workflow showing the tests running and failing because of accessibility issues.

To be more precise, the Action uses the pa11y-ci command-line interface to run the Axe accessibility checks against a list of new or changed pages.

I've written a bash script to calculate the URLs of the pages which have changed, which won't catch all changes, but will catch the vast majority in a way which is both simple and compute-cheap, and in particular will catch new blog posts.

The Action is triggered by Pull Requests and pushes to gh-pages.

Running the tests only against the changed pages is quicker and uses less compute. To figure out which pages have changed in a way which is fairly simple and doesn't require too much compute, I've written a script, generate_pa11y_ci_urls_from_git_diff, which calculates the relative URLs of the pages which have changed given a Git diff against a provided base. This approach misses out on pages which have changed as a result of changes to Jekyll layouts and includes, but since the vast majority of changes are new blog posts, this approach should be good enough.

Screenshot of script working, generate_pa11y_ci_urls_from_git_diff

Since colour contrast is a known issue, I've configured aXe to ignore colour contrast issues.

@jcarstairs-scottlogic jcarstairs-scottlogic force-pushed the pa11y-ci branch 18 times, most recently from 1df5653 to 9374fb1 Compare November 29, 2023 14:05
@jcarstairs-scottlogic jcarstairs-scottlogic changed the base branch from gh-pages to docs-readme November 29, 2023 14:09
@jcarstairs-scottlogic jcarstairs-scottlogic changed the base branch from docs-readme to gh-pages November 29, 2023 14:09
@jcarstairs-scottlogic jcarstairs-scottlogic force-pushed the pa11y-ci branch 5 times, most recently from 7c0a32c to ae028b8 Compare November 29, 2023 14:42
Copy link
Owner

@ithake ithake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also suggest an update to a readme of some kind to mention the new functionality.

.gitignore Show resolved Hide resolved
.pa11yci.js Outdated Show resolved Hide resolved
generate_pa11y_ci_urls_from_git_diff.sh Show resolved Hide resolved
generate_pa11y_ci_urls_from_git_diff.sh Show resolved Hide resolved
generate_pa11y_ci_urls_from_git_diff.sh Outdated Show resolved Hide resolved
generate_pa11y_ci_urls_from_git_diff.sh Outdated Show resolved Hide resolved
generate_pa11y_ci_urls_from_git_diff.sh Show resolved Hide resolved
generate_pa11y_ci_urls_from_git_diff.sh Show resolved Hide resolved
@ithake
Copy link
Owner

ithake commented Nov 29, 2023

Incidentally +1 for moving the logic out of ruby and into javascript to avoid the need for an unsafe plugin!

.pa11yci.js Show resolved Hide resolved
ithake and others added 3 commits December 8, 2023 15:42
…ce (ScottLogic#124)

* refactor: include author-link.html

- pass in author id to reduce boiler plate.

* refactor: includes author-link.html author-summary.html

- author-link: created to reduce boilerplate.
- author-summary: pass in author-id
- default_post: remove whitespace before comma in list of contributors

---------

Co-authored-by: Ian Thake <[email protected]>
…colour contrast ratio (ScottLogic#131)

* Updates node-sass -> dart-sass

* Pulls out colours to separate file

* Fixes grey text colour contrast ratio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants