You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@sa11y/format

Package Overview
Dependencies
Maintainers
4
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sa11y/format

Accessibility results re-formatter

7.3.1
latest
Source
npmnpm
Version published
Weekly downloads
14K
-12.05%
Maintainers
4
Weekly downloads
 
Created
Source

@sa11y/format

Format accessibility results from axe

  • Usage

Usage

Basic Formatting

import axe from 'axe-core';
import { A11yError } from '@sa11y/format';

const results = await axe.run();
console.log(A11yError.checkAndThrow(results.violations));

Exception List Filtering

Filter out specific accessibility violations based on rule ID and CSS selectors:

import { exceptionListFilter, exceptionListFilterSelectorKeywords } from '@sa11y/format';

// Filter by rule ID and specific CSS selectors
const exceptionList = {
    'color-contrast': ['.btn-secondary', '.text-muted'],
    'landmark-one-main': ['body'],
};
const filteredResults = exceptionListFilter(violations, exceptionList);

// Filter by selector keywords
const keywords = ['known-issue', 'legacy-component'];
const keywordFilteredResults = exceptionListFilterSelectorKeywords(violations, keywords);

Result Processing

Process and enhance accessibility results with WCAG metadata:

import { A11yResult, appendWcag } from '@sa11y/format';

// Process individual result
const processedResult = new A11yResult(violationData);

// Add WCAG metadata to results
const resultsWithWcag = appendWcag(violations);

Keywords

accessibility

FAQs

Package last updated on 03 Jul 2025

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