
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
@helptheweb/accessibility-engine
Advanced tools
Custom accessibility testing engine for WCAG compliance
A modular, extensible accessibility testing engine for WCAG compliance. Built as a modern alternative to axe-core with first-class support for Bun.js.
bun add @helptheweb/accessibility-engine
Or with npm:
npm install @helptheweb/accessibility-engine
import createAccessibilityEngine from '@helptheweb/accessibility-engine';
// Create engine instance
const engine = createAccessibilityEngine();
// Run accessibility tests
const results = await engine.run();
// Check for violations
if (results.violations.length > 0) {
console.log('Accessibility violations found:', results.violations);
}
# Test a URL
helptheweb test https://example.com
# Test a local HTML file
helptheweb test index.html
# Output results to a file
helptheweb test https://example.com --output report.html --format html
# Run only Level A tests
helptheweb test https://example.com --ruleset wcag22a
# Show detailed results
helptheweb test https://example.com --verbose
# List all available rules
helptheweb list
# Explain a specific rule
helptheweb explain img-alt
const engine = createAccessibilityEngine({
// Run only specific WCAG levels
runOnly: ['wcag22a', 'wcag22aa'],
// Choose result types to include
resultTypes: ['violations', 'incomplete'],
// Custom reporter version
reporter: 'v2'
});
// Test a specific form
const form = document.querySelector('#signup-form');
const results = await engine.run(form);
// Test with callback
engine.run(document, (error, results) => {
if (error) {
console.error('Error:', error);
} else {
console.log('Results:', results);
}
});
Every rule includes a plain English explanation to help non-technical users understand accessibility issues:
{
id: 'img-alt',
help: 'Images must have an alt attribute',
explanation: 'Images need text descriptions so screen reader users know what the image shows. Think of it like describing a photo to someone over the phone.',
// ... rest of the violation details
}
wcag22a
- WCAG 2.2 Level A rules (essential accessibility)wcag22aa
- WCAG 2.2 Level A and AA rules (recommended standard)wcag22aaa
- All WCAG 2.2 rules (highest standard)Full TypeScript definitions are included:
import createAccessibilityEngine, {
AccessibilityEngine,
Report,
Rule,
EngineOptions
} from '@helptheweb/accessibility-engine';
const engine: AccessibilityEngine = createAccessibilityEngine({
runOnly: ['wcag22a']
});
const results: Report = await engine.run();
const customRule = {
id: 'custom-rule',
selector: '.my-component',
tags: ['custom'],
impact: 'moderate',
description: 'Custom components must follow guidelines',
help: 'Ensure custom components are accessible',
explanation: 'Your custom widgets need to work for everyone, including people using screen readers or keyboards.',
helpUrl: 'https://example.com/docs/custom-rule',
evaluate: (element) => {
// Your test logic here
return {
passed: true,
message: null
};
}
};
engine.registerRule(customRule);
engine.registerRuleset('custom-rules', ['custom-rule', 'another-rule']);
// Run only custom rules
const results = await engine.run(document, {
runOnly: 'custom-rules'
});
Colored terminal output with summaries and details
Machine-readable format for CI/CD pipelines
Beautiful report with charts and detailed findings
Spreadsheet-compatible format for tracking
The engine is designed to work seamlessly with API endpoints:
// Example API endpoint
app.post('/api/accessibility/test', async (req, res) => {
const { html, options } = req.body;
// Create DOM from HTML string
const dom = new JSDOM(html);
const document = dom.window.document;
const engine = createAccessibilityEngine(options);
const results = await engine.run(document);
res.json(results);
});
# Install dependencies
bun install
# Run tests
bun test
# Build for production
bun run build
# Lint code
bun run lint
# Test CLI locally
bun run cli test https://example.com
The engine is optimized for speed:
Typical performance:
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
MIT License - see LICENSE file for details.
Built with ❤️ for the HelpTheWeb.org project.
FAQs
Custom accessibility testing engine for WCAG compliance
We found that @helptheweb/accessibility-engine demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.