diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..97b70fd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI +on: + push: + branches: [ main ] + pull_request: +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + - run: npm ci + - run: npx playwright install --with-deps chromium + - run: npm test + commitlint: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + - run: npm ci + - run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 5865fa9..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Lint -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Super-Linter - uses: github/super-linter@V3.8.0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3da4784..104c21a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,21 +2,28 @@ name: Release on: push: branches: [ main ] +permissions: + contents: write + issues: write + pull-requests: write jobs: release: name: Release runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: - node-version: '14' + node-version: 22 + cache: npm - name: Install dependencies run: npm ci + - name: Build + run: npm run build - name: Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index f06235c..5bb1c76 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules dist +test-results +playwright-report diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 0000000..da99483 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1 @@ +npx --no -- commitlint --edit "$1" diff --git a/README.md b/README.md index 8bc790f..0e30d95 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,100 @@ # inaccessible.css -![NPM Version 1.2.0](https://img.shields.io/npm/v/inaccessible.css?style=for-the-badge) +[![npm](https://img.shields.io/npm/v/inaccessible.css?style=for-the-badge)](https://www.npmjs.com/package/inaccessible.css) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge)](https://github.com/semantic-release/semantic-release) -A stylesheet to highlight inaccessible markup. It'll add an obnoxious red outline around elements which are lacking important attributes. +A drop-in stylesheet that highlights inaccessible markup while you develop. Problems get an obnoxious outline: -## Violations -The stylesheet will highlight the following accessibility mistakes: +- **Red** for errors: markup that fails WCAG. +- **Orange** for warnings: markup that is usually a problem but might be fine in context. -- Document missing the `lang` -- Images missing an `alt` -- Labels without a `for` -- Links without an `href` -- iframes without a `title` +Where the browser allows it, a short label also explains the problem, for example "Label not linked to a control". Images, form fields, frames and video can't show these labels, so they only get an outline. + +It's a quick visual check, not a replacement for an automated audit (such as axe) or testing with real assistive technology. Some checks can't be done in CSS, such as checking that a `