← Back to Analysis

Accessibility Agent

accessibility.check.js

What 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.

High

Form Labels

Validates that form inputs have associated labels.

High

Language Attribute

Checks for lang attribute on the html element.

Medium

Link Text

Ensures links have descriptive text (not just "click here").

Medium

ARIA Attributes

Validates proper use of ARIA roles and attributes.

Medium

Skip Links

Checks for skip navigation links for keyboard users.

Low

Heading Order

Ensures headings follow logical hierarchy (H1 → H2 → H3).

Medium

Color Contrast

Notes about color contrast (requires visual analysis).

High

Data Sources

Libraries Used

  • axios — HTTP client for fetching the page
  • cheerio — 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
  ]
}