-
-
Notifications
You must be signed in to change notification settings - Fork 389
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.
Basic example, runs all default plugins with a exception of a few slow ones.
var respecConfig = {
lint: {
a11y: true,
}
};
Example with Axe configuration, as per Axe's configuration options.
var respecConfig = {
lint: {
a11y: {
runOnly: ["image-alt", "link-name"],
},
},
};
Another example:
var respecConfig = {
lint: {
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 },
},
},
},
};
If the document has accessibility issues, they will show up as ReSpec warnings:
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.
You can also use respecConfig.a11y
to define the linter config (instead of respecConfig.lint.a11y
). This lets us quickly run the linter by adding a URL param ?a11y=true
.
💖 Support ReSpec by becoming a sponsor via Open Collective. 💖
✨ View rendered version of this documentation at https://respec.org/docs/ ✨
- addSectionLinks
- authors
- caniuse
- edDraftURI
- editors
- favicon
- format (markdown)
- formerEditors
- github
- highlightVars
- isPreview
- license
- lint
- localBiblio
- logos
- maxTocLevel
- mdn
- modificationDate
- noTOC
- otherLinks
- pluralize
- postProcess
- preProcess
- previousDiffURI
- previousMaturity
- previousPublishDate
- prevRecShortname
- prevRecURI
-
processVersion(Deprecated) - publishDate
-
refNote(Deprecated) - shortName
- specStatus
- subjectPrefix
- subtitle
- testSuiteURI
- xref
- additionalCopyrightHolders
-
addPatentNote(Deprecated) - alternateFormats
- canonicalURI
- charterDisclosureURI
- copyrightStart
- crEnd
-
darkMode(deprecated, use dark mode) - doJsonLd
- errata
- group
- implementationReportURI
- lcEnd
- level
- noRecTrack
- prevED
- submissionCommentNumber
-
wg(Deprecated) -
wgId(Deprecated) -
wgPatentPolicy(Deprecated) -
wgPatentURI(Deprecated) - wgPublicList
-
wgURI(Deprecated)
a11y
check-punctuation
local-refs-exist
no-headingless-sections
no-http-props
no-unused-vars
no-unused-dfns
informative-dfn
privsec-section
wpt-tests-exist
Handled by ReSpec for you.
- data-abbr
-
data-cite(Not recommended) - data-dfn-for
- data-dfn-type
- data-format
- data-include-format
- data-include-replace
- data-include
- data-link-for
- data-link-type
- data-local-lt
- data-lt-no-plural
- data-lt-noDefault
- data-lt
- data-number
- data-oninclude
- data-sort
- data-tests
-
data-transform(Deprecated) - data-type
- dir
- lang