Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sa11y/preset-rules

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sa11y/preset-rules

Accessibility preset rule configs for axe

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.7K
decreased by-56.02%
Maintainers
1
Weekly downloads
 
Created
Source

@sa11y/preset-rules

Accessibility preset rule configs for axe

  • Usage
  • Ruleset Mapping

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 environment variable.
  • The SA11Y_RULESET_PRIORITY environment variable can be used to select rules of specified priority in a ruleset.

Rules

Rule IDDescriptionWCAG SCWCAG LevelPriorityIn Base rulesetIn Extended ruleset
accesskeysEnsures every accesskey attribute value is unique4.1.1AP3
area-altEnsures <area> elements of image maps have alternate text1.1.1AP1
aria-allowed-attrEnsures ARIA attributes are allowed for an element's role4.1.2AP1
aria-allowed-roleEnsures role attribute has an appropriate value for the element4.1.2AP1
aria-command-nameEnsures every ARIA button, link and menuitem has an accessible name4.1.2AP1
aria-dialog-nameEnsures every ARIA dialog and alertdialog node has an accessible name4.1.2AP1
aria-hidden-bodyEnsures aria-hidden='true' is not present on the document body.4.1.2AP1
aria-hidden-focusEnsures aria-hidden elements do not contain focusable elements4.1.2AP1
aria-input-field-nameEnsures every ARIA input field has an accessible name4.1.2AP1
aria-meter-nameEnsures every ARIA meter node has an accessible name4.1.2AP1
aria-progressbar-nameEnsures every ARIA progressbar node has an accessible name4.1.2AP1
aria-required-attrEnsures elements with ARIA roles have all required ARIA attributes4.1.2AP1
aria-required-childrenEnsures elements with an ARIA role that require child roles contain them4.1.2AP1
aria-required-parentEnsures 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-rolesEnsures all elements with a role attribute use a valid value4.1.2AP1
aria-textEnsures "role=text" is used on elements with no focusable descendants4.1.1AP3
aria-toggle-field-nameEnsures every ARIA toggle field has an accessible name4.1.2AP1
aria-tooltip-nameEnsures every ARIA tooltip node has an accessible name4.1.2AP1
aria-treeitem-nameEnsures every ARIA treeitem node has an accessible name4.1.2AP1
aria-valid-attrEnsures attributes that begin with aria- are valid ARIA attributes4.1.2AP3
aria-valid-attr-valueEnsures all ARIA attributes have valid values4.1.2AP3
audio-captionEnsures <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
blinkEnsures <blink> elements are not used2.2.2AP1
button-nameEnsures buttons have discernible text4.1.2AP1
bypassEnsures each page has at least one mechanism for a user to bypass navigation and jump straight to the content2.4.1AP3
color-contrastEnsures the contrast between foreground and background colors meets WCAG 2 AA contrast ratio thresholds1.4.3AAP1
definition-listEnsures <dl> elements are structured correctly1.3.1AP2
dlitemEnsures <dt> and <dd> elements are contained by a <dl>1.3.1AP2
document-titleEnsures each HTML document contains a non-empty <title> element2.4.2AP2
duplicate-idEnsures every id attribute value is unique4.1.1AP3
duplicate-id-activeEnsures every id attribute value of active elements is unique4.1.1AP3
duplicate-id-ariaEnsures every id attribute value used in ARIA and in labels is unique4.1.2AP1
empty-headingEnsures headings have discernible text1.3.1AP2
empty-table-headerEnsures table headers have discernible text1.3.1AP2
form-field-multiple-labelsEnsures form field does not have multiple label elements2.5.3AP2
frame-focusable-contentEnsures <frame> and <iframe> elements with focusable content do not have tabindex=-12.1.1AP1
frame-titleEnsures <iframe> and <frame> elements have an accessible name2.4.2AP3
heading-orderEnsures the order of headings is semantically correct1.3.1AP2
html-has-langEnsures every HTML document has a lang attribute3.1.1AP2
html-lang-validEnsures 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-altEnsures <img> elements have alternate text or a role of none or presentation1.1.1AP1
image-redundant-altEnsure image alternative is not repeated as text1.1.1AP3
input-button-nameEnsures input buttons have discernible text4.1.2AP1
input-image-altEnsures <input type="image"> elements have alternate text1.1.1AP1
labelEnsures every form element has a label3.3.2AP1
label-title-onlyEnsures that every form element is not solely labeled using the title or aria-describedby attributes3.3.2AP1
landmark-banner-is-top-levelEnsures the banner landmark is at top level4.1.1AP3
landmark-complementary-is-top-levelEnsures the complementary landmark or aside is at top level4.1.1AP3
landmark-contentinfo-is-top-levelEnsures the contentinfo landmark is at top level4.1.1AP3
landmark-main-is-top-levelEnsures the main landmark is at top level4.1.1AP3
landmark-no-duplicate-bannerEnsures the document has at most one banner landmark4.1.1AP3
landmark-no-duplicate-contentinfoEnsures the document has at most one contentinfo landmark4.1.1AP3
landmark-no-duplicate-mainEnsures the document has at most one main landmark4.1.1AP3
landmark-one-mainEnsures the document has a main landmark4.1.1AP3
landmark-uniqueLandmarks should have a unique role or role/label/title (i.e. accessible name) combination4.1.1AP3
link-nameEnsures links have discernible text4.1.2AP1
listEnsures that lists are structured correctly1.3.1AP2
listitemEnsures <li> elements are used semantically1.3.1AP2
marqueeEnsures <marquee> elements are not used2.2.2AP1
meta-refreshEnsures <meta http-equiv="refresh"> is not used2.2.1AP1
meta-viewportEnsures <meta name="viewport"> does not disable text scaling and zooming1.4.4AAP2
meta-viewport-largeEnsures <meta name="viewport"> can scale a significant amount1.4.4AAP2
nested-interactiveNested interactive controls are not announced by screen readers4.1.2AP1
object-altEnsures <object> elements have alternate text1.1.1AP1
page-has-heading-oneEnsure that the page, or at least one of its frames contains a level-one heading1.3.1AP2
presentation-role-conflictFlags elements whose role is none or presentation and which cause the role conflict resolution to trigger.4.1.1AP3
role-img-altEnsures [role='img'] elements have alternate text1.1.1AP1
scope-attr-validEnsures the scope attribute is used correctly on tables1.3.1AP1
scrollable-region-focusableElements that have scrollable content must be accessible by keyboard2.1.1AP1
select-nameEnsures select element has an accessible name4.1.2AP1
server-side-image-mapEnsures that server-side image maps are not used2.1.1AP1
svg-img-altEnsures svg elements with an img, graphics-document or graphics-symbol role have an accessible text1.1.1AP1
tabindexEnsures tabindex attribute values are not greater than 02.4.3AP2
td-headers-attrEnsure that each cell in a table using the headers refers to another cell in that table1.3.1AP1
th-has-data-cellsEnsure that each table header in a data table refers to data cells1.3.1AP1
valid-langEnsures lang attributes have valid values3.1.1AP2
video-captionEnsures <video> elements have captions1.2.2AP1
css-orientation-lockEnsures content is not locked to any specific display orientation, and the content is operable in all display orientations1.3.4AAP3✖️
focus-order-semanticsEnsures elements in the focus order have an appropriate roleP3✖️
frame-testedEnsures <iframe> and <frame> elements contain the axe-core scriptP3✖️
frame-title-uniqueEnsures <iframe> and <frame> elements contain a unique title attributeP3✖️
hidden-contentInforms users about hidden content.P3✖️
identical-links-same-purposeEnsure that links with the same accessible name serve a similar purpose2.4.9AAAP3✖️
label-content-name-mismatchEnsures that elements labelled through their content must have their visible text as part of their accessible name2.5.3AP2✖️
link-in-text-blockLinks can be distinguished without relying on color1.4.1AP1✖️
no-autoplay-audioEnsures <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✖️
p-as-headingEnsure p elements are not used to style headings1.3.1AP2✖️
regionEnsures all page content is contained by landmarksP3✖️
skip-linkEnsure all skip links have a focusable targetP3✖️
table-duplicate-nameEnsure that tables do not have the same summary and captionP3✖️
table-fake-captionEnsure that tables with a caption use the <caption> element.P3✖️
td-has-headerEnsure that each non-empty data cell in a large table has one or more table headers1.3.1AP1✖️

Keywords

FAQs

Package last updated on 16 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc