Expand description
Accessibility-related functionality for HTML processing.
This module provides comprehensive tools for improving HTML accessibility through:
- Automated ARIA attribute management
- WCAG 2.1 compliance validation
- Accessibility issue detection and correction
§WCAG Compliance
This module implements checks for WCAG 2.1 compliance across three levels:
- Level A (minimum level of conformance)
- Level AA (addresses major accessibility barriers)
- Level AAA (highest level of accessibility conformance)
For detailed information about WCAG guidelines, see: https://www.w3.org/WAI/WCAG21/quickref/
§Limitations
While this module provides automated checks, some accessibility aspects require manual review, including:
- Semantic correctness of ARIA labels
- Meaningful alternative text for images
- Logical heading structure
- Color contrast ratios
§Examples
use html_generator::accessibility::{add_aria_attributes, validate_wcag, WcagLevel};
use html_generator::accessibility::AccessibilityConfig;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let html = r#"<button>Click me</button>"#;
// Add ARIA attributes automatically
let enhanced_html = add_aria_attributes(html, None)?;
// Validate against WCAG AA level
let config = AccessibilityConfig::default();
validate_wcag(&enhanced_html, &config, None)?;
Ok(())
}
Modules§
- Constants used throughout the accessibility module
- Utility functions for accessibility checks
Structs§
- Color contrast requirements for different WCAG levels
- A comprehensive accessibility check result
- Structure representing an accessibility issue found in the HTML
Enums§
- Enum to represent possible accessibility-related errors.
- Types of accessibility issues that can be detected
- WCAG Conformance Levels
Functions§
- Add ARIA attributes to HTML for improved accessibility.
- Validate HTML against WCAG guidelines with detailed reporting.
Type Aliases§
- Result type alias for accessibility operations.