6.12.1 • Published 7 months ago

@sa11y/preset-rules v6.12.1

Weekly downloads
974
License
BSD-3-Clause
Repository
github
Last release
7 months ago

@sa11y/preset-rules

Accessibility preset rule configs for axe

Usage

import axe from 'axe-core';
import { base } from '@sa11y/preset-rules';

const a11yResults = await axe.run(base);
console.log(a11yResults);

Ruleset Mapping

@sa11y/preset-rules provides three pre-configured rule set curated from axe: base, extended and full.

  • Below is the set of rules from axe rule descriptions and their current mapping to the base and extended rulesets in @sa11y/preset-rules.
  • base contains WCAG 2.1 AA rules available in axe-core.
  • extended contains WCAG AAA rules, experimental rules and non-WCAG best-practice rules.
  • full ruleset consists of all rules that are enabled by default in axe.
  • The default ruleset used by the sa11y APIs is base.
    • This can be overridden using the SA11Y_RULESET process environment variable.
  • The SA11Y_RULESET_PRIORITY process environment variable can be used to select rules of specified priority in a ruleset.

Rules

Rule IDDescriptionWCAG SCWCAG LevelPriorityIn Base rulesetIn Extended ruleset
area-altEnsure <area> elements of image maps have alternate text1.1.1AP1
aria-allowed-attrEnsure an element's role supports its ARIA attributes4.1.2AP1
aria-allowed-roleEnsure role attribute has an appropriate value for the element4.1.2AP1
aria-command-nameEnsure every ARIA button, link and menuitem has an accessible name4.1.2AP1
aria-dialog-nameEnsure every ARIA dialog and alertdialog node has an accessible name4.1.2AP1
aria-hidden-bodyEnsure aria-hidden="true" is not present on the document body.4.1.2AP1
aria-hidden-focusEnsure aria-hidden elements are not focusable nor contain focusable elements4.1.2AP1
aria-input-field-nameEnsure every ARIA input field has an accessible name4.1.2AP1
aria-meter-nameEnsure every ARIA meter node has an accessible name4.1.2AP1
aria-progressbar-nameEnsure every ARIA progressbar node has an accessible name4.1.2AP1
aria-required-attrEnsure elements with ARIA roles have all required ARIA attributes4.1.2AP1
aria-required-childrenEnsure elements with an ARIA role that require child roles contain them4.1.2AP1
aria-required-parentEnsure elements with an ARIA role that require parent roles are contained by them4.1.2AP1
aria-roledescriptionEnsure aria-roledescription is only used on elements with an implicit or explicit role4.1.2AP3
aria-rolesEnsure all elements with a role attribute use a valid value4.1.2AP1
aria-toggle-field-nameEnsure every ARIA toggle field has an accessible name4.1.2AP1
aria-tooltip-nameEnsure every ARIA tooltip node has an accessible name4.1.2AP1
aria-treeitem-nameEnsure every ARIA treeitem node has an accessible name4.1.2AP1
aria-valid-attrEnsure attributes that begin with aria- are valid ARIA attributes4.1.2AP3
aria-valid-attr-valueEnsure all ARIA attributes have valid values4.1.2AP3
audio-captionEnsure <audio> elements have captions1.2.2AP1
autocomplete-validEnsure the autocomplete attribute is correct and suitable for the form field1.3.5AAP2
avoid-inline-spacingEnsure that text spacing set through style attributes can be adjusted with custom stylesheets1.4.12AAP3
blinkEnsure <blink> elements are not used2.2.2AP1
button-nameEnsure buttons have discernible text4.1.2AP1
bypassEnsure each page has at least one mechanism for a user to bypass navigation and jump straight to the content2.4.1AP3
color-contrastEnsure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds1.4.3AAP1
definition-listEnsure <dl> elements are structured correctly1.3.1AP2
dlitemEnsure <dt> and <dd> elements are contained by a <dl>1.3.1AP2
document-titleEnsure each HTML document contains a non-empty <title> element2.4.2AP2
duplicate-idEnsure every id attribute value is unique4.1.1AP3
duplicate-id-activeEnsure every id attribute value of active elements is unique4.1.1AP3
duplicate-id-ariaEnsure every id attribute value used in ARIA and in labels is unique4.1.2AP1
form-field-multiple-labelsEnsure form field does not have multiple label elements2.5.3AP2
frame-focusable-contentEnsure <frame> and <iframe> elements with focusable content do not have tabindex=-12.1.1AP1
frame-titleEnsure <iframe> and <frame> elements have an accessible name2.4.2AP3
html-has-langEnsure every HTML document has a lang attribute3.1.1AP2
html-lang-validEnsure the lang attribute of the <html> element has a valid value3.1.1AP2
html-xml-lang-mismatchEnsure that HTML elements with both valid lang and xml:lang attributes agree on the base language of the page3.1.1AP2
image-altEnsure <img> elements have alternate text or a role of none or presentation1.1.1AP1
input-button-nameEnsure input buttons have discernible text4.1.2AP1
input-image-altEnsure <input type="image"> elements have alternate text1.1.1AP1
labelEnsure every form element has a label3.3.2AP1
label-title-onlyEnsure that every form element has a visible label and is not solely labeled using hidden labels, or the title or aria-describedby attributes3.3.2AP1
link-nameEnsure links have discernible text4.1.2AP1
listEnsure that lists are structured correctly1.3.1AP2
listitemEnsure <li> elements are used semantically1.3.1AP2
marqueeEnsure <marquee> elements are not used2.2.2AP1
meta-refreshEnsure <meta http-equiv="refresh"> is not used for delayed refresh2.2.1AP1
meta-viewportEnsure <meta name="viewport"> does not disable text scaling and zooming1.4.4AAP2
nested-interactiveEnsure interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies4.1.2AP1
object-altEnsure <object> elements have alternate text1.1.1AP1
presentation-role-conflictElements marked as presentational should not have global ARIA or tabindex to ensure all screen readers ignore them4.1.1AP3
role-img-altEnsure role="img" elements have alternate text1.1.1AP1
scope-attr-validEnsure the scope attribute is used correctly on tables1.3.1AP1
scrollable-region-focusableEnsure elements that have scrollable content are accessible by keyboard2.1.1AP1
select-nameEnsure select element has an accessible name4.1.2AP1
server-side-image-mapEnsure that server-side image maps are not used2.1.1AP1
svg-img-altEnsure <svg> elements with an img, graphics-document or graphics-symbol role have an accessible text1.1.1AP1
tabindexEnsure tabindex attribute values are not greater than 02.4.3AP2
td-headers-attrEnsure that each cell in a table that uses the headers attribute refers only to other cells in that table1.3.1AP1
th-has-data-cellsEnsure that <th> elements and elements with role=columnheader/rowheader have data cells they describe1.3.1AP1
valid-langEnsure lang attributes have valid values3.1.1AP2
video-captionEnsure <video> elements have captions1.2.2AP1
accesskeysEnsure every accesskey attribute value is unique4.1.1AP3✖️
aria-textEnsure role="text" is used on elements with no focusable descendants4.1.1AP3✖️
color-contrast-enhancedEnsure the contrast between foreground and background colors meets WCAG 2 AAA enhanced contrast ratio thresholds1.4.6AAAP3✖️
css-orientation-lockEnsure content is not locked to any specific display orientation, and the content is operable in all display orientations1.3.4AAP3✖️
empty-headingEnsure headings have discernible text1.3.1AP2✖️
empty-table-headerEnsure table headers have discernible text1.3.1AP2✖️
focus-order-semanticsEnsure elements in the focus order have a role appropriate for interactive contentP3✖️
frame-testedEnsure <iframe> and <frame> elements contain the axe-core scriptP3✖️
frame-title-uniqueEnsure <iframe> and <frame> elements contain a unique title attributeP3✖️
heading-orderEnsure the order of headings is semantically correct1.3.1AP2✖️
hidden-contentInforms users about hidden content.P3✖️
identical-links-same-purposeEnsure that links with the same accessible name serve a similar purpose2.4.9AAAP3✖️
image-redundant-altEnsure image alternative is not repeated as text1.1.1AP3✖️
label-content-name-mismatchEnsure that elements labelled through their content must have their visible text as part of their accessible name2.5.3AP2✖️
landmark-banner-is-top-levelEnsure the banner landmark is at top level4.1.1AP3✖️
landmark-complementary-is-top-levelEnsure the complementary landmark or aside is at top level4.1.1AP3✖️
landmark-contentinfo-is-top-levelEnsure the contentinfo landmark is at top level4.1.1AP3✖️
landmark-main-is-top-levelEnsure the main landmark is at top level4.1.1AP3✖️
landmark-no-duplicate-bannerEnsure the document has at most one banner landmark4.1.1AP3✖️
landmark-no-duplicate-contentinfoEnsure the document has at most one contentinfo landmark4.1.1AP3✖️
landmark-no-duplicate-mainEnsure the document has at most one main landmark4.1.1AP3✖️
landmark-one-mainEnsure the document has a main landmark4.1.1AP3✖️
landmark-uniqueEnsure landmarks are unique4.1.1AP3✖️
link-in-text-blockEnsure links are distinguished from surrounding text in a way that does not rely on color1.4.1AP1✖️
meta-refresh-no-exceptionsEnsure <meta http-equiv="refresh"> is not used for delayed refreshP3✖️
meta-viewport-largeEnsure <meta name="viewport"> can scale a significant amount1.4.4AAP2✖️
no-autoplay-audioEnsure <video> or <audio> elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio1.4.2AP1✖️
page-has-heading-oneEnsure that the page, or at least one of its frames contains a level-one heading1.3.1AP2✖️
p-as-headingEnsure bold, italic text and font-size is not used to style <p> elements as a heading1.3.1AP2✖️
regionEnsure all page content is contained by landmarksP3✖️
skip-linkEnsure all skip links have a focusable targetP3✖️
table-duplicate-nameEnsure the <caption> element does not contain the same text as the summary attributeP3✖️
table-fake-captionEnsure that tables with a caption use the <caption> element.P3✖️
target-sizeEnsure touch targets have sufficient size and space2.5.5AAAP3✖️
td-has-headerEnsure that each non-empty data cell in a <table> larger than 3 by 3 has one or more table headers1.3.1AP1✖️
aria-braille-equivalentEnsure aria-braillelabel and aria-brailleroledescription have a non-braille equivalentP3✖️
aria-conditional-attrEnsure ARIA attributes are used as described in the specification of the element's roleP3✖️
aria-prohibited-attrEnsure ARIA attributes are not prohibited for an element's roleP3✖️
aria-deprecated-roleEnsure elements do not use deprecated rolesP3✖️

| summary-name | Ensure summary elements have discernible text | | | P3 | ✖️ | ✅ |

6.13.0-alpha.1

7 months ago

6.12.1

8 months ago

6.12.0

8 months ago

6.11.0

9 months ago

6.10.3

9 months ago

6.10.2

9 months ago

6.10.1-alpha.1

11 months ago

6.8.0

1 year ago

6.7.1-alpha.4

1 year ago

6.10.1

11 months ago

6.10.0

11 months ago

6.9.5-alpha.1

1 year ago

6.10.2-alpha.1

11 months ago

6.9.5-alpha.2

1 year ago

6.9.5-alpha.3

12 months ago

6.9.5-alpha.4

12 months ago

6.10.2-alpha.2

11 months ago

6.9.0

1 year ago

6.10.2-alpha.3

11 months ago

6.9.2

1 year ago

6.9.1

1 year ago

6.9.4

1 year ago

6.9.3

1 year ago

6.9.5

11 months ago

6.7.1-alpha.3

1 year ago

6.7.1-alpha.2

1 year ago

6.7.1-alpha.1

1 year ago

6.7.0

1 year ago

6.6.2

1 year ago

6.6.1

1 year ago

6.6.0

1 year ago

6.5.1

1 year ago

6.5.0

1 year ago

6.4.0

1 year ago

6.3.2

1 year ago

6.3.1

1 year ago

6.3.0

1 year ago

6.2.3

1 year ago

6.3.0-alpha.1

1 year ago

5.3.2

2 years ago

5.3.1

2 years ago

5.3.0

2 years ago

6.1.0

2 years ago

6.0.0

2 years ago

6.2.1

2 years ago

6.1.2

2 years ago

6.2.0

2 years ago

6.1.1

2 years ago

6.2.2

2 years ago

5.2.0

2 years ago

5.1.0

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

4.1.4

2 years ago

4.1.5

2 years ago

4.1.3

2 years ago

4.1.2

2 years ago

4.1.0

2 years ago

4.1.1

2 years ago

4.0.0-alpha.7

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

4.0.0-alpha.0

3 years ago

3.1.0

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.3.7

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.2-beta.0

5 years ago

0.2.1-beta.0

5 years ago

0.2.0-beta.0

5 years ago

0.1.3-alpha

5 years ago