Skip to content
Sid Vishnoi edited this page Jul 6, 2020 · 13 revisions

a11y

Lints for accessibility issues using axe-core: "Axe is an accessibility testing engine for websites and other HTML-based user interfaces".

Note: Using this on hosted documents (e.g., on GitHub pages) can slow down the rendering and may make the page unresponsive. Please only enable only the rules you need.

Example of usage

Basic example, runs all default plugins with a exception of a few slow ones.

var respecConfig = {
  a11y: true,
};

Example with Axe configuration, as per Axe's configuration options.

var respecConfig = {
  a11y: {
    runOnly: ["image-alt", "link-name"],
  },
};

Another example:

var respecConfig = {
  a11y: {
    // run all rules, except "image-alt" and slow rules (but run "color-contrast")
    rules: {
      "color-contrast": { enabled: true }, // disabled by default, enable it
      "image-alt": { enabled: false },
    },
  },
};

Example output

If the document has accessibility issues, they will show up as ReSpec warnings:

Accessibility warnings in ReSpec

In an actual document, you can expand the details to get more information about each issue along with a link to the specific HTML element causing the issue.

Guides

Configuration options

W3C Configuration options

Linter rules

Internal properties

Handled by ReSpec for you.

Special <section> IDs

HTML elements

Custom Elements

WebIDL

HTML attributes

CSS Classes

Special properties

Clone this wiki locally