• Stars
    star
    5,705
  • Rank 6,933 (Top 0.2 %)
  • Language
    JavaScript
  • License
    Mozilla Public Li...
  • Created about 9 years ago
  • Updated 28 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Accessibility engine for automated Web UI testing

axe-core

License Version Total npm downloads Commits GitHub contributors Join our Slack chat Package Quality

Axe is an accessibility testing engine for websites and other HTML-based user interfaces. It's fast, secure, lightweight, and was built to seamlessly integrate with any existing test environment so you can automate accessibility testing alongside your regular functional testing.

Sign up for axe news to get the latest on axe features, future releases, and events.

The Accessibility Rules

Axe-core has different types of rules, for WCAG 2.0, 2.1, 2.2 on level A, AA and AAA as well as a number of best practices that help you identify common accessibility practices like ensuring every page has an h1 heading, and to help you avoid "gotchas" in ARIA like where an ARIA attribute you used will get ignored. The complete list of rules, grouped WCAG level and best practice, can found in doc/rule-descriptions.md.

With axe-core, you can find on average 57% of WCAG issues automatically. Additionally, axe-core will return elements as "incomplete" where axe-core could not be certain, and manual review is needed.

To catch bugs earlier in the development cycle we recommend using the axe-linter vscode extension. To improve test coverage even further we recommend the intelligent guided tests in the axe Extension.

Getting started

First download the package:

npm install axe-core --save-dev

Now include the javascript file in each of your iframes in your fixtures or test systems:

<script src="node_modules/axe-core/axe.min.js"></script>

Now insert calls at each point in your tests where a new piece of UI becomes visible or exposed:

axe
  .run()
  .then(results => {
    if (results.violations.length) {
      throw new Error('Accessibility issues found');
    }
  })
  .catch(err => {
    console.error('Something bad happened:', err.message);
  });

Philosophy

The web can only become an accessible, inclusive space if developers are empowered to take responsibility for accessibility testing and accessible coding practices.

Automated accessibility testing is a huge timesaver, it doesn't require special expertise, and it allows teams to focus expert resources on the accessibility issues that really need them. Unfortunately, most accessibility tools are meant to be run on sites and applications that have reached the end of the development process and often don't give clear or consistent results, causing frustration and delays just when you thought your product was ready to ship.

Axe was built to reflect how web development actually works. It works with all modern browsers, tools, and testing environments a dev team might use. With axe, accessibility testing can be performed as part of your unit testing, integration testing, browser testing, and any other functional testing your team already performs on a day-to-day basis. Building accessibility testing into the early development process saves time, resources, and all kinds of frustration.

About axe - our Manifesto

  • Axe is open source.
  • It returns zero false positives (bugs notwithstanding).
  • It's designed to work on all modern browsers and with whatever tools, frameworks, libraries and environments you use today.
  • It's actively supported by Deque Systems, a major accessibility vendor.
  • It integrates with your existing functional/acceptance automated tests.
  • It automatically determines which rules to run based on the evaluation context.
  • Axe supports in-memory fixtures, static fixtures, integration tests and iframes of infinite depth.
  • Axe is highly configurable.

Supported Browsers

The axe-core API fully supports the following browsers:

  • Microsoft Edge v40 and above
  • Google Chrome v42 and above
  • Mozilla Firefox v38 and above
  • Apple Safari v7 and above
  • Internet Explorer v11 (DEPRECATED)

Support means that we will fix bugs and attempt to test each browser regularly. Only Chrome and Firefox are currently tested on every pull request.

There is limited support for JSDOM. We will attempt to make all rules compatible with JSDOM but where this is not possible, we recommend turning those rules off. Currently the color-contrast rule is known not to work with JSDOM.

We can only support environments where features are either natively supported or polyfilled correctly. We do not support the deprecated v0 Shadow DOM implementation.

Contents of the API Package

The axe-core API package consists of:

  • axe.js - the JavaScript file that should be included in your web site under test (API)
  • axe.min.js - a minified version of the above file

Localization

Axe can be built using your local language. To do so, a localization file must be added to the ./locales directory. This file must have be named in the following manner: <langcode>.json. To build axe using this locale, instead of the default, run axe with the --lang flag, like so:

grunt build --lang=nl

or equivalently:

npm run build -- --lang=nl

This will create a new build for axe, called axe.<lang>.js and axe.<lang>.min.js. If you want to build localized versions, simply pass in --all-lang instead. If you want to build multiple localized versions (but not all of them), you can pass in a comma-separated list of languages to the --lang flag, like --lang=nl,ja.

To create a new translation for axe, start by running grunt translate --lang=<langcode>. This will create a json file fin the ./locales directory, with the default English text in it for you to translate. Alternatively, you could copy ./locales/_template.json. We welcome any localization for axe-core. For details on how to contribute, see the Contributing section below. For details on the message syntax, see Check Message Template.

To update existing translation file, re-run grunt translate --lang=<langcode>. This will add new messages used in English and remove messages which were not used in English.

Additionally, locale can be applied at runtime by passing a locale object to axe.configure(). The locale object must be of the same shape as existing locales in the ./locales directory. For example:

axe.configure({
  locale: {
    lang: 'de',
    rules: {
      accesskeys: {
        help: 'Der Wert des accesskey-Attributes muss einzigartig sein.'
      }
      // ...
    },
    checks: {
      abstractrole: {
        fail: 'Abstrakte ARIA-Rollen dürfen nicht direkt verwendet werden.'
      },
      'aria-errormessage': {
        // Note: doT (https://github.com/olado/dot) templates are supported here.
        fail: 'Der Wert der aria-errormessage ${data.values}` muss eine Technik verwenden, um die Message anzukündigen (z. B., aria-live, aria-describedby, role=alert, etc.).'
      }
      // ...
    }
  }
});

Supported Locales

Axe-core supports the following locales. Do note that since locales are contributed by our community, they are not guaranteed to include all translations needed in a release.

  • Basque
  • Danish
  • Dutch
  • French
  • German
  • Hebrew
  • Japanese
  • Korean
  • Norwegian (Bokmål)
  • Polish
  • Portuguese (Brazilian)
  • Spanish

Updates & Security

Axe-core has a new minor release every 3 to 5 months, which usually introduces new rules and features. We recommend scheduling time to upgrade to these versions. Security updates will be made available for minor version lines up to 18 months old.

  • See release and support for details on the frequency of releases, long-term support and recommendations on upgrading axe-core.
  • See backward compatibility for details on the types of changes different releases may introduce.

Deque Trademarks Policy

DEQUE, DEQUELABS, AXE®, and AXE-CORE® are trademarks of Deque Systems, Inc. Use of the Deque trademarks must be in accordance with Deque's trademark policy.

Supported ARIA Roles and Attributes.

Refer axe-core ARIA support for a complete list of ARIA supported roles and attributes by axe.

Contributing

Read the Proposing Axe-core Rules guide

Read the documentation on the architecture

Read the documentation on contributing

Projects using axe-core

List of projects using axe-core

Acknowledgements

Thanks to Marat Dulin for his css-selector-parser implementation which is included for shadow DOM support.

Thanks to the Slick Parser implementers for their contribution, we have used some of their algorithms in our shadow DOM support code.

More Repositories

1

react-axe

[DEPRECATED] Accessibility auditing for React.js applications
TypeScript
1,157
star
2

axe-core-npm

JavaScript
570
star
3

axe-cli

[Deprecated] A command-line interface for the aXe accessibility testing engine
JavaScript
431
star
4

axe-webdriverjs

Provides a chainable axe API for Selenium's WebDriverJS and automatically injects into all frames.
JavaScript
130
star
5

pattern-library

Deque pattern library
JavaScript
116
star
6

cauldron

TypeScript
82
star
7

axe-core-gems

Ruby integration for axe-core, the accessibility testing engine
Ruby
81
star
8

agnostic-axe

Framework agnostic accessibility reporter, powered by axe-core
JavaScript
80
star
9

axe-core-maven-html

Tools for using axe for web accessibility testing with JUnit, Selenium, and Playwright
Java
79
star
10

ngA11y

Angular accessibility modules
JavaScript
74
star
11

axe-android

WCAG Accessibility compliance library for Android Applications.
Java
65
star
12

axe-puppeteer

[DEPRECATED] Provides a chainable axe API for Puppeteer and automatically injects into all frames.
TypeScript
59
star
13

combobo

Accessible combobox
JavaScript
49
star
14

Deque-University-for-iOS

Accessibility demos and best practices for the iOS platform. Need iOS Accessibility help? Ask us a question by adding an Issue to this repository! Help us build a community of iOS Accessibility experts.
HTML
37
star
15

color-palette

Color Palette Color Contrast Analyzer
JavaScript
33
star
16

workshop

Workshop
JavaScript
27
star
17

Deque-University-for-Android

All you need to improve the Accessibility of your Android Applications in one place! Build the application to see Accessible Examples, check out Attest for debugging tools, or post an Issue to leverage our community of Android Accessibility experts.
Java
27
star
18

puppeteer-devtools

Extended puppeteer methods for getting extension devtools contexts
TypeScript
17
star
19

axe-firefox-devtools

Integration of axe-core into the Firefox developer tools
17
star
20

smashing-workshop

JavaScript
17
star
21

axe-core-nuget

Axe Core integration for C# .NET
C#
16
star
22

foreign-keycloak-wrapper

PGXN PostgreSQL foreign data wrapper for keycloak's REST API
Python
16
star
23

axe-selenium-java

Tools for using aXe for web accessibility testing with JUnit and Selenium.
Java
14
star
24

cauldron-react

TypeScript
14
star
25

axe-rules

The Accessibility Rules for automated testing of HTML-based user interfaces.
12
star
26

grunt-axe-webdriver

JavaScript
11
star
27

axe-selector

TypeScript
10
star
28

axe-matchers

[DEPRECATED] Ruby integration for aXe-core, the accessibility testing engine
Ruby
9
star
29

csun20-aria-menu-button

JavaScript
9
star
30

axrl

Accessibility Reporting Language
JavaScript
9
star
31

corro

A powerful, extensible validation framework for node.js.
JavaScript
8
star
32

get-it-right-the-first-time

TypeScript
6
star
33

axe-linter-action

A GitHub Action to lint for any accessibility issues in your pull requests.
Shell
6
star
34

axe-reporter-earl

[DEPRECATED] A reporter for axe-core.
TypeScript
5
star
35

action-sync-branches

Creates a sync pull request between two branches
TypeScript
5
star
36

csun19-tdd-component

Live coding at csun 2019!
JavaScript
5
star
37

axe-devtools-android-sample-app

Kotlin
5
star
38

axe

Package for marketing all of our open source projects
4
star
39

axe-devtools-ios-sample-app

Swift
4
star
40

axe-devtools-html-api-examples

Library of example projects for axe DevTools HTML api integrations
JavaScript
4
star
41

react-wai-accordion

TypeScript
4
star
42

a11y-in-design-and-development

Smashing workshop | Day II | October 4th, 2022
JavaScript
2
star
43

axe-website

Website for axe-core
JavaScript
2
star
44

eslint-config-deque

Our extensible ESLint configuration
JavaScript
2
star
45

axe-devtools-ios

Start testing for accessibility in your iOS application today with axe DevTools for iOS. Please refer to the README to get started.
Objective-C
2
star
46

monitor-utility

Previously the "Comply custom reporter" from Devservices, now useful for any customer. Allows customers to login via the CLI and fetch detailed data from their Monitor projects.
JavaScript
2
star
47

semantic-pr-title

A GitHub Action to validate pr titles against Conventional Commits
TypeScript
2
star
48

act-reports-axe

ACT reports for axe-core and axe DevTools
TypeScript
1
star
49

hr-a11y-workshop

JavaScript
1
star
50

element-matches

Element#matches un-prefixer
JavaScript
1
star
51

Form-Personalization

A simple chrome browser extension to support personalization of input forms utilizing the auto complete attribute.
JavaScript
1
star
52

attest-release-scripts

Shell
1
star
53

axe-test-fixtures

Fixtures for testing integrations of axe-core
JavaScript
1
star
54

axe-act-testrunner

Axe-core testrunner using the ACT test case format
JavaScript
1
star
55

iOS-Increase-Contrast

Swift
1
star
56

a11y-metrics-poc

A POC for Deque A11Y Metrics
1
star
57

axeDevToolsMobileTools

Mobile tools to demonstrate REST API's from python
Python
1
star
58

action-twistlock

A GitHub action for scanning a Docker image with Twistlock
JavaScript
1
star
59

watcher-examples

TypeScript
1
star