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

Long-term: CI accessibility audits #218

Closed
mattxwang opened this issue Jul 26, 2021 · 7 comments
Closed

Long-term: CI accessibility audits #218

mattxwang opened this issue Jul 26, 2021 · 7 comments
Assignees
Labels
long term a problem that we'd have to work on over a long chunk of time

Comments

@mattxwang
Copy link
Member

(matt will flesh this out later!)

@mattxwang mattxwang added the long term a problem that we'd have to work on over a long chunk of time label Jul 26, 2021
@mattxwang
Copy link
Member Author

Also, just wanted to shout out Tim Gu's detailed issue in the hack repo: uclaacm/hack.uclaacm.com#229

@mattxwang mattxwang self-assigned this Aug 10, 2021
@mattxwang
Copy link
Member Author

mattxwang added a commit that referenced this issue Aug 20, 2021
…t dev`, enables `eslint-plugin-jsx-a11y` on `strict` (#245)

This PR does a couple of things:

1. installs and enables `eslint-plugin-jsx-a11y`, and turns it on with `strict` mode
    * this triggers on the navbar improperly using the `<label>` element, which is a valid concern. reworking it involves changing the DOM structure of the navbar, which in turn breaks the CSS - I'd like to table fixing this until we rework the navbar
    * this also triggers on next's `<Link><a></a></Link>` pattern, which is realistically a false-positive. Unfortunately, there's no great solution to this, and as such I've temporarily disabled the rule for `<Link>`; see the comments in the eslint config for more info
2. installs and enables `@axe-core/react`, which logs accessibility issues to the console in dev
    * there are **a ton** of issues to resolve. so, I'll scope that out for another PR instead. 

Something that's still left to be desired is to get aXe's level of accessibility specificity, but getting it as a CI action (like `eslint-plugin-jsx-a11y`) - will figure that out soon!

Part of #218.
@mattxwang
Copy link
Member Author

This should be easier now that #245 is merged!

@mattxwang
Copy link
Member Author

Something that Arjun sent my way: https://userway.org/

@mattxwang
Copy link
Member Author

@mattxwang
Copy link
Member Author

@mattxwang
Copy link
Member Author

For posterity's sake: uclaacm/teach-la-website#244

mattxwang added a commit that referenced this issue Jan 31, 2022
This PR implements the minimum overhead required to run `jest-axe` via GitHub Actions on a set of predefined components. In order, we:

1. install `jest`, `jest-axe`, `@testing-library/react`, `@testing-library/jest-dom`, the minimum set up for a viable test infrastructure
    1. to install `jest`, we add a general `jest.config.js` as a jest configuration file, and `jest.setup.js` as a pre-test setup file (automatically importing our dependencies)
    2. creates a set of mock module mappers for "non-code" webpack elements; a stub file mock (`__mocks__/fileMock.js`) for most files, and the `identity-obj-proxy` to proxy-back CSS/SASS/SCSS class names
    3. adds the `next` preset to babel
    4. adjusts the ESLint config to use the jest environment
2. implements a rudimentary accessibility test in `NewsArticle.test.js`, which is a simple subcomponent with no errors. You can validate this working by adding an arbitrary `<img />` to `NewsArticle.js`; `npm test` will throw an error.
3. implements a rudimentary failing accessibility test in `Footer.test.js`, where an `<ul>` has children that are not `<li>` - showing that negatives work. I then resolve this issue.
4. updates the "Node.JS CI" action to be "Build and Test", and runs `npm test` in it

Ideally, you should be able to add more test files following the configuration in `NewsArticle.test.js`; note the strange `let` pattern with the async version of `act`.

I didn't use the native next testing plugin, since that seems blocked by the upgrade to Next 12 (#409).

Part of #218, supersedes #301.

Relevant reading:

* [Configuring Jest](https://jestjs.io/docs/configuration)
* [`act()` in React](https://reactjs.org/docs/test-utils.html#act)
* [Blog Post: Next.js 11: Setup & Config for Testing, Linting, and Absolute Imports](https://benjaminwfox.medium.com/next-js-setup-config-for-testing-linting-and-absolute-imports-605959d7bd6f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
long term a problem that we'd have to work on over a long chunk of time
Projects
None yet
Development

No branches or pull requests

2 participants