New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@qualweb/act-rules

Package Overview
Dependencies
Maintainers
3
Versions
209
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qualweb/act-rules

ACT-R module for qualweb accessibility evaluator

  • 0.3.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
411
increased by136.21%
Maintainers
3
Weekly downloads
 
Created
Source

QualWeb ACT Rules Module

Implementation of the ACT rules.

How to install

  $ npm i @qualweb/act-rules --save

How to run

  'use strict';

  const { ACTRules } = require('@qualweb/act-rules');

  (async () => {
    const dom = await getDom('https://act-rules.github.io/pages/about/');

    const actRules = new ACTRules();

    const report = await actRules.execute(sourceHtml, page, stylesheets);

    // print rules executed
    console.log(Object.keys(report));
    // ['QW-ACT-R1', 'QW-ACT-R2', 'QW-ACT-R3', ...]

    // print rule outcome
    console.log(report['QW-ACT-R1'].metadata.outcome);
    // 'passed' | 'failed' | 'inapplicable'

    // print rule results
    console.log(report['QW-ACT-R1'].results[0]);
    // {
    //   verdict: 'passed'
    //   description: 'HTML page has title element'
    //   resultCode: 'RC1'
    //   htmlCode: '<title>Some title</title>'
    //   pointer: 'html > head > title'
    // }
  })();

Configure

If you want you can configure the module to run only specific rules, or rules based on their principles and conform levels.

'use strict';

  const { getDom } = require('@qualweb/get-dom-puppeteer');
  const { ACTRules } = require('@qualweb/act-rules');

  (async () => {
    const options = {
      rules: ['QW-ACT-R1', 'QW-ACT-R2', 'bf051a'], // will execute these rules regarding the other options given
      principles: ['Understandable'], // will only execute rules that belong to the 'Understandable' principle
      levels: ['A', 'AA'] // will only execute rules that belong to the 'A' and 'AA' conform levels
    };

    const actRules = new ACTRules(options);
    // OR
    const actRules = new ACTRules();
    actRules.configure(options);

    // In this case, with these options, all rules that belong to the 'Understandable' principle and the 'A' and 'AA' conform levels and rules 'QW-ACT-R1' and 'QW-ACT-R2' and 'bf051a' will be executed

    const report = await actRules.execute(sourceHtml, page, stylesheets);
  })();

Implemente rules

QualWeb Rule IDACT Rule IDACT Rule Name
QW-ACT-R12779a5HTML Page has a title
QW-ACT-R2b5c3f8HTML has lang attribute
QW-ACT-R35b7ae0HTML lang and xml:lang match
QW-ACT-R4bc659aMeta-refresh no delay
QW-ACT-R5bf051aValidity of HTML Lang attribute
QW-ACT-R659796fImage button has accessible name
QW-ACT-R7b33effOrientation of the page is not restricted using CSS transform property
QW-ACT-R89eb3f6Image filename is accessible name for image
QW-ACT-R9b20e66Links with identical accessible names have equivalent purpose
QW-ACT-R104b1c6ciframe elements with identical accessible names have equivalent purpose
QW-ACT-R1197a4e1Button has accessible name
QW-ACT-R12c487aeLink has accessible name
QW-ACT-R136cfa84Element with aria-hidden has no focusable content
QW-ACT-R14b4f0c3meta viewport does not prevent zoom
QW-ACT-R16e086e5Form control has accessible name
QW-ACT-R1723a2a8Image has accessible name
QW-ACT-R183ea0c8id attribute value is unique
QW-ACT-R19cae760iframe element has accessible name
QW-ACT-R20674b10role attribute has valid value
QW-ACT-R217d6734svg element with explicit role has accessible name
QW-ACT-R22de46e4Element within body has valid lang attribute

License

ISC

Keywords

FAQs

Package last updated on 08 Jan 2020

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