Accessibility Agent
accessibility.check.jsWhat This Agent Does
The Accessibility Agent evaluates WCAG 2.1 compliance, checking for alt text, form labels, ARIA attributes, keyboard navigation, and other accessibility features that ensure websites are usable by everyone.
Category Information
| Property | Value |
|---|---|
| Category Name | Accessibility |
| Category Icon | |
| Source File | src/checks/accessibility.check.js |
Checks Performed
Image Alt Text
Checks that all images have descriptive alt attributes.
HighForm Labels
Validates that form inputs have associated labels.
HighLanguage Attribute
Checks for lang attribute on the html element.
MediumLink Text
Ensures links have descriptive text (not just "click here").
MediumARIA Attributes
Validates proper use of ARIA roles and attributes.
MediumSkip Links
Checks for skip navigation links for keyboard users.
LowHeading Order
Ensures headings follow logical hierarchy (H1 → H2 → H3).
MediumColor Contrast
Notes about color contrast (requires visual analysis).
HighData Sources
Libraries Used
axios— HTTP client for fetching the pagecheerio— jQuery-like HTML parsing
Accessibility Parsing
const cheerio = require('cheerio');
const response = await axios.get(url);
const $ = cheerio.load(response.data);
// Check images for alt text
const images = $('img');
const imagesWithoutAlt = images.filter((i, el) => !$(el).attr('alt'));
// Check form labels
const inputs = $('input, select, textarea');
const unlabeledInputs = inputs.filter((i, el) => {
const id = $(el).attr('id');
return !$(`label[for="${id}"]`).length && !$(el).attr('aria-label');
});
// Check language
const langAttr = $('html').attr('lang');
// Check for skip links
const skipLink = $('a[href^="#main"], a[href^="#content"]');
WCAG 2.1 Guidelines
Compliance Levels
- Level A — Minimum accessibility requirements
- Level AA — Standard for most websites (recommended)
- Level AAA — Highest level of accessibility
SiteSentinel checks primarily target Level A and Level AA criteria.
Return Value
{
category: 'Accessibility',
icon: 'accessibility',
score: 0-100,
checks: [
{
name: 'Image Alt Text',
status: 'pass' | 'warn' | 'fail',
description: 'All 12 images have alt attributes',
severity: 'high'
},
{
name: 'Form Labels',
status: 'pass' | 'fail',
description: 'All form inputs have associated labels',
severity: 'high'
},
// ... more checks
]
}