Expand description
§ssg-a11y — Standalone WCAG 2.2 AA accessibility checker
Framework-agnostic, build-time HTML validation against a subset of
WCAG 2.2 Level AA success criteria, plus ARIA landmark checks. This
crate has no dependency on any web framework — it operates purely
on &str HTML in, AccessibilityIssue data out — so it can be
embedded in the build pipeline of any Rust site/app generator
(static site generators, Leptos, Dioxus, Yew, etc).
let html = r#"<html><head></head><body><main><img src="a.jpg"></main></body></html>"#;
let issues = ssg_a11y::check_page(html);
assert!(issues.iter().any(|i| i.criterion == "1.1.1"));§Checks performed
- 1.1.1 Non-text content (
<img alt>) - 1.3.1 Heading hierarchy (no skipped levels)
- 2.3.1 Banned elements (
<marquee>,<blink>) - 2.4.4 Link purpose (discernible text or
aria-label) - 2.4.13 Focus appearance —
:focus { outline: none }without a compensating style is flagged (WCAG 2.2 addition) - 2.5.8 Target size minimum — explicit
width/height< 24 px on interactive selectors flagged (WCAG 2.2 addition) - 3.1.1 Page language (
<html lang>) - 3.2.6 Consistent help — a standalone helper is provided
(
check_pagedoes not call it directly; see its docs) for informational cross-page analysis (WCAG 2.2 addition) - ARIA landmarks (single
<main>,<nav aria-label>)
build_compliance_report additionally produces a full WCAG 2.2
compliance matrix (WcagComplianceReport) mapping every criterion
in the spec to its automation status (automated / runtime-only /
manual / not-applicable), so a consumer can report on and track
conformance beyond what this crate can check automatically.
Structs§
- Accessibility
Issue - An individual accessibility issue found in a page.
- Accessibility
Report - Full accessibility report.
- Criterion
Entry - One row of the WCAG 2.2 compliance matrix.
- Page
Report - Accessibility report for a single page.
- Wcag
Compliance Report - WCAG 2.2 compliance matrix describing which criteria this crate can verify automatically, and whether every scanned page passed them.
Enums§
- Criterion
Status - How a single WCAG criterion is verified.
Functions§
- build_
compliance_ report - Constructs the WCAG 2.2 compliance matrix. Marks
all_pages_pass=falsefor any criterion that produced at least one issue across the scan. - check_
consistent_ help - WCAG 2.2 — 3.2.6 Consistent Help (Level A).
- check_
page - Runs all WCAG checks on a single HTML page.
- find_
tag_ end - Scan to the end of an HTML tag.