diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 722093522b..3fd044b90a 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -1,10 +1,18 @@ name: Formatter -on: [pull_request] +on: + pull_request: + branches: + - develop jobs: prettier: + # This conditional prevents running the job on PRs from forks; won't + # have permissions to commit changes, so the job would fail if it ran. + # PRs from forks will instead rely on failing the fmt_check job in test.yml + if: github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest + timeout-minutes: 5 steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9b6e4cc28e..71f8e1a074 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,18 @@ jobs: path: axe.js retention-days: 1 + fmt_check: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + - run: npm ci + - run: npm run fmt:check + test_node: strategy: matrix: diff --git a/CHANGELOG.md b/CHANGELOG.md index 86eef014c9..29dca789b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [4.10.1](https://github.com/dequelabs/axe-core/compare/v4.10.0...v4.10.1) (2024-10-16) + +### Bug Fixes + +- **aria-allowed-role:** add form to allowed roles of form element ([#4588](https://github.com/dequelabs/axe-core/issues/4588)) ([d462d67](https://github.com/dequelabs/axe-core/commit/d462d674bb7de0848ce2695f80b95d677c5016e0)), closes [/github.com/dequelabs/axe-core/blob/develop/lib/standards/html-elms.js#L264](https://github.com/dequelabs//github.com/dequelabs/axe-core/blob/develop/lib/standards/html-elms.js/issues/L264) +- **axe.d.ts:** add typings for preload options object ([#4543](https://github.com/dequelabs/axe-core/issues/4543)) ([72e269f](https://github.com/dequelabs/axe-core/commit/72e269f1e6d6039e70e614005f04ebfd3fe5aca5)) +- **button-name,input-button-name,input-img-alt:** allow label to give accessible name ([#4607](https://github.com/dequelabs/axe-core/issues/4607)) ([364eb72](https://github.com/dequelabs/axe-core/commit/364eb72bb8f20b0ffc31be24cc96cbd349c301cb)), closes [#4472](https://github.com/dequelabs/axe-core/issues/4472) [#3696](https://github.com/dequelabs/axe-core/issues/3696) [#3696](https://github.com/dequelabs/axe-core/issues/3696) +- **get-ancestry:** add nth-child selector for multiple siblings of shadow root ([#4606](https://github.com/dequelabs/axe-core/issues/4606)) ([bdd94a2](https://github.com/dequelabs/axe-core/commit/bdd94a227a95cd5b9f8e2a1e0fd259ddd702810c)), closes [#4563](https://github.com/dequelabs/axe-core/issues/4563) +- **rules:** Change "alternate text" to "alternative text" ([#4582](https://github.com/dequelabs/axe-core/issues/4582)) ([31e0f61](https://github.com/dequelabs/axe-core/commit/31e0f61ca871b3df86468577c449a02c8ece12f0)) + ## [4.10.0](https://github.com/dequelabs/axe-core/compare/v4.9.1...v4.10.0) (2024-07-29) ### Features diff --git a/README.md b/README.md index 8848b0a3e3..635a1d93ee 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # axe-core -[![License](https://img.shields.io/npm/l/axe-core.svg)](LICENSE) +[![License](https://img.shields.io/npm/l/axe-core.svg?color=c41)](LICENSE) [![Version](https://img.shields.io/npm/v/axe-core.svg)](https://www.npmjs.com/package/axe-core) -[![Total npm downloads](https://img.shields.io/npm/dt/axe-core.svg)](https://www.npmjs.com/package/axe-core) +[![NPM downloads](https://img.shields.io/npm/dw/axe-core.svg?color=080)![](https://img.shields.io/npm/dy/axe-core.svg?color=080&label=)](https://npm-stat.com/charts.html?package=axe-core&from=2017-01-01) [![Commits](https://img.shields.io/github/commit-activity/y/dequelabs/axe-core.svg)](https://github.com/dequelabs/axe-core/commits/develop) -[![GitHub contributors](https://img.shields.io/github/contributors/dequelabs/axe-core.svg)](https://github.com/dequelabs/axe-core/graphs/contributors) +[![GitHub contributors](https://img.shields.io/github/contributors/dequelabs/axe-core.svg?color=080)](https://github.com/dequelabs/axe-core/graphs/contributors) [![Join our Slack chat](https://img.shields.io/badge/slack-chat-purple.svg?logo=slack)](https://accessibility.deque.com/axe-community) [![Package Quality](https://npm.packagequality.com/shield/axe-core.svg)](https://packagequality.com/#?package=axe-core) diff --git a/axe.d.ts b/axe.d.ts index 5c4197a872..47bca29ff0 100644 --- a/axe.d.ts +++ b/axe.d.ts @@ -143,10 +143,14 @@ declare namespace axe { iframes?: boolean; elementRef?: boolean; frameWaitTime?: number; - preload?: boolean; + preload?: boolean | PreloadOptions; performanceTimer?: boolean; pingWaitTime?: number; } + interface PreloadOptions { + assets: string[]; + timeout?: number; + } interface AxeResults extends EnvironmentData { toolOptions: RunOptions; passes: Result[]; diff --git a/bower.json b/bower.json index 87018d7ffa..90cb051ba4 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "axe-core", - "version": "4.10.0", + "version": "4.10.1", "deprecated": true, "contributors": [ { diff --git a/doc/examples/jest_react/jest.setup.js b/doc/examples/jest_react/jest.setup.js deleted file mode 100644 index c07c082506..0000000000 --- a/doc/examples/jest_react/jest.setup.js +++ /dev/null @@ -1,4 +0,0 @@ -const Enzyme = require('enzyme'); -const Adapter = require('@wojtekmaj/enzyme-adapter-react-17'); - -Enzyme.configure({ adapter: new Adapter() }); diff --git a/doc/examples/jest_react/link.test.js b/doc/examples/jest_react/link.test.js index d9bd25271f..3fafe01690 100644 --- a/doc/examples/jest_react/link.test.js +++ b/doc/examples/jest_react/link.test.js @@ -1,16 +1,12 @@ import React from 'react'; -import { mount, render } from 'enzyme'; +import { render } from '@testing-library/react'; import axe from 'axe-core'; import Link from './link'; test('Link has no axe violations', done => { - const fixture = document.createElement('div'); - document.body.appendChild(fixture); - - const linkComponent = mount( - axe website, - { attachTo: fixture } + const { container } = render( + axe website ); const config = { @@ -19,7 +15,7 @@ test('Link has no axe violations', done => { 'link-in-text-block': { enabled: false } } }; - axe.run(fixture, config, (err, { violations }) => { + axe.run(container, config, (err, { violations }) => { expect(err).toBe(null); expect(violations).toHaveLength(0); done(); diff --git a/doc/examples/jest_react/package.json b/doc/examples/jest_react/package.json index 0a67634b91..b4b104f089 100644 --- a/doc/examples/jest_react/package.json +++ b/doc/examples/jest_react/package.json @@ -12,20 +12,16 @@ "test": "jest" }, "devDependencies": { - "@babel/preset-env": "^7.20.2", - "@babel/preset-react": "^7.18.6", - "@wojtekmaj/enzyme-adapter-react-17": "^0.8.0", - "axe-core": "^4.6.2", - "enzyme": "^3.11.0", - "jest": "^29.3.1", - "jest-environment-jsdom": "^29.3.1", - "react": "^17.0.2", - "react-dom": "^17.0.2" + "@babel/preset-env": "^7.25.3", + "@babel/preset-react": "^7.24.7", + "@testing-library/jest-dom": "^6.4.8", + "@testing-library/react": "^16.0.0", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", + "react": "^18.3.1", + "react-dom": "^18.3.1" }, "jest": { - "testEnvironment": "jsdom", - "setupFilesAfterEnv": [ - "/jest.setup.js" - ] + "testEnvironment": "jsdom" } } diff --git a/doc/examples/qunit/Gruntfile.js b/doc/examples/qunit/Gruntfile.js index bc50188c67..19c11eedf5 100644 --- a/doc/examples/qunit/Gruntfile.js +++ b/doc/examples/qunit/Gruntfile.js @@ -8,12 +8,7 @@ module.exports = function (grunt) { all: ['test/**/*.html'], options: { puppeteer: { - ignoreDefaultArgs: true, - args: [ - '--headless', - '--disable-web-security', - '--allow-file-access-from-files' - ] + args: ['--disable-web-security', '--allow-file-access-from-files'] }, timeout: 10000 } diff --git a/doc/examples/qunit/package.json b/doc/examples/qunit/package.json index 68c36555dc..4cd12bc766 100644 --- a/doc/examples/qunit/package.json +++ b/doc/examples/qunit/package.json @@ -13,9 +13,9 @@ }, "devDependencies": { "axe-core": "^4.6.2", - "grunt": "^1.5.3", - "grunt-contrib-qunit": "^5.1.1", - "puppeteer": "^19.5.0", - "qunitjs": "^2.0.1" + "grunt": "^1.6.1", + "grunt-contrib-qunit": "^10.1.1", + "puppeteer": "^23.1.0", + "qunit": "^2.22.0" } } diff --git a/doc/examples/qunit/test/test.html b/doc/examples/qunit/test/test.html index e7a3acbb5c..49c28f9f12 100644 --- a/doc/examples/qunit/test/test.html +++ b/doc/examples/qunit/test/test.html @@ -6,10 +6,10 @@ - + diff --git a/doc/rule-descriptions.md b/doc/rule-descriptions.md index cd10e730b6..88e5e5f57d 100644 --- a/doc/rule-descriptions.md +++ b/doc/rule-descriptions.md @@ -16,7 +16,7 @@ | Rule ID | Description | Impact | Tags | Issue Type | ACT Rules | | :-------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :--------------------------------------------------------------------------------------------------------------------------------- | :------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [area-alt](https://dequeuniversity.com/rules/axe/4.10/area-alt?application=RuleDescription) | Ensure <area> elements of image maps have alternate text | Critical | cat.text-alternatives, wcag2a, wcag244, wcag412, section508, section508.22.a, TTv5, TT6.a, EN-301-549, EN-9.2.4.4, EN-9.4.1.2, ACT | failure, needs review | [c487ae](https://act-rules.github.io/rules/c487ae) | +| [area-alt](https://dequeuniversity.com/rules/axe/4.10/area-alt?application=RuleDescription) | Ensure <area> elements of image maps have alternative text | Critical | cat.text-alternatives, wcag2a, wcag244, wcag412, section508, section508.22.a, TTv5, TT6.a, EN-301-549, EN-9.2.4.4, EN-9.4.1.2, ACT | failure, needs review | [c487ae](https://act-rules.github.io/rules/c487ae) | | [aria-allowed-attr](https://dequeuniversity.com/rules/axe/4.10/aria-allowed-attr?application=RuleDescription) | Ensure an element's role supports its ARIA attributes | Critical | cat.aria, wcag2a, wcag412, EN-301-549, EN-9.4.1.2 | failure, needs review | [5c01ea](https://act-rules.github.io/rules/5c01ea) | | [aria-braille-equivalent](https://dequeuniversity.com/rules/axe/4.10/aria-braille-equivalent?application=RuleDescription) | Ensure aria-braillelabel and aria-brailleroledescription have a non-braille equivalent | Serious | cat.aria, wcag2a, wcag412, EN-301-549, EN-9.4.1.2 | needs review | | | [aria-command-name](https://dequeuniversity.com/rules/axe/4.10/aria-command-name?application=RuleDescription) | Ensure every ARIA button, link and menuitem has an accessible name | Serious | cat.aria, wcag2a, wcag412, TTv5, TT6.a, EN-301-549, EN-9.4.1.2, ACT | failure, needs review | [97a4e1](https://act-rules.github.io/rules/97a4e1) | @@ -51,9 +51,9 @@ | [html-has-lang](https://dequeuniversity.com/rules/axe/4.10/html-has-lang?application=RuleDescription) | Ensure every HTML document has a lang attribute | Serious | cat.language, wcag2a, wcag311, TTv5, TT11.a, EN-301-549, EN-9.3.1.1, ACT | failure | [b5c3f8](https://act-rules.github.io/rules/b5c3f8) | | [html-lang-valid](https://dequeuniversity.com/rules/axe/4.10/html-lang-valid?application=RuleDescription) | Ensure the lang attribute of the <html> element has a valid value | Serious | cat.language, wcag2a, wcag311, TTv5, TT11.a, EN-301-549, EN-9.3.1.1, ACT | failure | [bf051a](https://act-rules.github.io/rules/bf051a) | | [html-xml-lang-mismatch](https://dequeuniversity.com/rules/axe/4.10/html-xml-lang-mismatch?application=RuleDescription) | Ensure that HTML elements with both valid lang and xml:lang attributes agree on the base language of the page | Moderate | cat.language, wcag2a, wcag311, EN-301-549, EN-9.3.1.1, ACT | failure | [5b7ae0](https://act-rules.github.io/rules/5b7ae0) | -| [image-alt](https://dequeuniversity.com/rules/axe/4.10/image-alt?application=RuleDescription) | Ensure <img> elements have alternate text or a role of none or presentation | Critical | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, TTv5, TT7.a, TT7.b, EN-301-549, EN-9.1.1.1, ACT | failure, needs review | [23a2a8](https://act-rules.github.io/rules/23a2a8) | +| [image-alt](https://dequeuniversity.com/rules/axe/4.10/image-alt?application=RuleDescription) | Ensure <img> elements have alternative text or a role of none or presentation | Critical | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, TTv5, TT7.a, TT7.b, EN-301-549, EN-9.1.1.1, ACT | failure, needs review | [23a2a8](https://act-rules.github.io/rules/23a2a8) | | [input-button-name](https://dequeuniversity.com/rules/axe/4.10/input-button-name?application=RuleDescription) | Ensure input buttons have discernible text | Critical | cat.name-role-value, wcag2a, wcag412, section508, section508.22.a, TTv5, TT5.c, EN-301-549, EN-9.4.1.2, ACT | failure, needs review | [97a4e1](https://act-rules.github.io/rules/97a4e1) | -| [input-image-alt](https://dequeuniversity.com/rules/axe/4.10/input-image-alt?application=RuleDescription) | Ensure <input type="image"> elements have alternate text | Critical | cat.text-alternatives, wcag2a, wcag111, wcag412, section508, section508.22.a, TTv5, TT7.a, EN-301-549, EN-9.1.1.1, EN-9.4.1.2, ACT | failure, needs review | [59796f](https://act-rules.github.io/rules/59796f) | +| [input-image-alt](https://dequeuniversity.com/rules/axe/4.10/input-image-alt?application=RuleDescription) | Ensure <input type="image"> elements have alternative text | Critical | cat.text-alternatives, wcag2a, wcag111, wcag412, section508, section508.22.a, TTv5, TT7.a, EN-301-549, EN-9.1.1.1, EN-9.4.1.2, ACT | failure, needs review | [59796f](https://act-rules.github.io/rules/59796f) | | [label](https://dequeuniversity.com/rules/axe/4.10/label?application=RuleDescription) | Ensure every form element has a label | Critical | cat.forms, wcag2a, wcag412, section508, section508.22.n, TTv5, TT5.c, EN-301-549, EN-9.4.1.2, ACT | failure, needs review | [e086e5](https://act-rules.github.io/rules/e086e5) | | [link-in-text-block](https://dequeuniversity.com/rules/axe/4.10/link-in-text-block?application=RuleDescription) | Ensure links are distinguished from surrounding text in a way that does not rely on color | Serious | cat.color, wcag2a, wcag141, TTv5, TT13.a, EN-301-549, EN-9.1.4.1 | failure, needs review | | | [link-name](https://dequeuniversity.com/rules/axe/4.10/link-name?application=RuleDescription) | Ensure links have discernible text | Serious | cat.name-role-value, wcag2a, wcag244, wcag412, section508, section508.22.a, TTv5, TT6.a, EN-301-549, EN-9.2.4.4, EN-9.4.1.2, ACT | failure, needs review | [c487ae](https://act-rules.github.io/rules/c487ae) | @@ -64,8 +64,8 @@ | [meta-viewport](https://dequeuniversity.com/rules/axe/4.10/meta-viewport?application=RuleDescription) | Ensure <meta name="viewport"> does not disable text scaling and zooming | Critical | cat.sensory-and-visual-cues, wcag2aa, wcag144, EN-301-549, EN-9.1.4.4, ACT | failure | [b4f0c3](https://act-rules.github.io/rules/b4f0c3) | | [nested-interactive](https://dequeuniversity.com/rules/axe/4.10/nested-interactive?application=RuleDescription) | Ensure interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies | Serious | cat.keyboard, wcag2a, wcag412, TTv5, TT6.a, EN-301-549, EN-9.4.1.2 | failure, needs review | [307n5z](https://act-rules.github.io/rules/307n5z) | | [no-autoplay-audio](https://dequeuniversity.com/rules/axe/4.10/no-autoplay-audio?application=RuleDescription) | Ensure <video> or <audio> elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio | Moderate | cat.time-and-media, wcag2a, wcag142, TTv5, TT2.a, EN-301-549, EN-9.1.4.2, ACT | needs review | [80f0bf](https://act-rules.github.io/rules/80f0bf) | -| [object-alt](https://dequeuniversity.com/rules/axe/4.10/object-alt?application=RuleDescription) | Ensure <object> elements have alternate text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, EN-301-549, EN-9.1.1.1 | failure, needs review | [8fc3b6](https://act-rules.github.io/rules/8fc3b6) | -| [role-img-alt](https://dequeuniversity.com/rules/axe/4.10/role-img-alt?application=RuleDescription) | Ensure [role="img"] elements have alternate text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, TTv5, TT7.a, EN-301-549, EN-9.1.1.1, ACT | failure, needs review | [23a2a8](https://act-rules.github.io/rules/23a2a8) | +| [object-alt](https://dequeuniversity.com/rules/axe/4.10/object-alt?application=RuleDescription) | Ensure <object> elements have alternative text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, EN-301-549, EN-9.1.1.1 | failure, needs review | [8fc3b6](https://act-rules.github.io/rules/8fc3b6) | +| [role-img-alt](https://dequeuniversity.com/rules/axe/4.10/role-img-alt?application=RuleDescription) | Ensure [role="img"] elements have alternative text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, TTv5, TT7.a, EN-301-549, EN-9.1.1.1, ACT | failure, needs review | [23a2a8](https://act-rules.github.io/rules/23a2a8) | | [scrollable-region-focusable](https://dequeuniversity.com/rules/axe/4.10/scrollable-region-focusable?application=RuleDescription) | Ensure elements that have scrollable content are accessible by keyboard | Serious | cat.keyboard, wcag2a, wcag211, wcag213, TTv5, TT4.a, EN-301-549, EN-9.2.1.1, EN-9.2.1.3 | failure | [0ssw9k](https://act-rules.github.io/rules/0ssw9k) | | [select-name](https://dequeuniversity.com/rules/axe/4.10/select-name?application=RuleDescription) | Ensure select element has an accessible name | Critical | cat.forms, wcag2a, wcag412, section508, section508.22.n, TTv5, TT5.c, EN-301-549, EN-9.4.1.2, ACT | failure, needs review | [e086e5](https://act-rules.github.io/rules/e086e5) | | [server-side-image-map](https://dequeuniversity.com/rules/axe/4.10/server-side-image-map?application=RuleDescription) | Ensure that server-side image maps are not used | Minor | cat.text-alternatives, wcag2a, wcag211, section508, section508.22.f, TTv5, TT4.a, EN-301-549, EN-9.2.1.1 | needs review | | diff --git a/lib/checks/label/explicit.json b/lib/checks/label/explicit.json index ab765720f8..0d4c4b0997 100644 --- a/lib/checks/label/explicit.json +++ b/lib/checks/label/explicit.json @@ -4,8 +4,8 @@ "metadata": { "impact": "critical", "messages": { - "pass": "Form element has an explicit