Add axe-core automated accessibility tests - #13348
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
| runOnly: [ 'wcag2a', 'wcag2aa' ], | ||
| rules: { | ||
| // This is only to test how to disable a rule. | ||
| 'aria-allowed-role': { enabled: false }, |
There was a problem hiding this comment.
Note that axe-core will report the group role added to the list item in the admin bar as a violation. Looks liek that's a known false positive. See dequelabs/axe-core#4910 and dequelabs/axe-core#3439
There was a problem hiding this comment.
Yes, that's well known; it's been reported against core a few times already. (Searched for the tickets, but didn't find them immediately.)
There was a problem hiding this comment.
Update: the axe-core rule aria-allowed-role runs only if the configuration allows to run the best-practice set of rules. In fact, this is a separate group of rules as aria-allowed-role isn't strictly required by the WCAG. We should make a decision on whether to run the best-practice rules as they may add many reported violations. Maybe we could introduce a flag to run them optionally.
dbaff60 to
086cb45
Compare
Trac ticket: https://core.trac.wordpress.org/ticket/66015
Proof Of Concept (POF) to add axe-core accessibility tests for the admin pages.
For now, this POF only scans one page.
Re-introduces the bug fixed in https://core.trac.wordpress.org/changeset/62851 for testing purposes.
npm installand then build.npm run test:e2e -- tests/e2e/specs/accessibility.spec.jsAxe documentation:
@axe-core/playwright documentation:
https://github.com/dequelabs/axe-core-npm/blob/develop/packages/playwright/README.md
Axe JavaScript Accessibility API
https://github.com/dequelabs/axe-core/blob/master/doc/API.md
Use of AI Tools
AI assistance: Yes
Tool(s): GitHub Copilot
Model(s): Claude Haiku 4.5
Used for: test suggestions; final implementation and tests were reviewed and edited by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.