UNPKG

a11yanalyze

Version:

A command-line tool for developers and QA engineers to test web pages and websites for WCAG 2.2 AA accessibility compliance

153 lines 5.1 kB
/** * WCAG 2.2 Success Criteria Database * Comprehensive database of WCAG success criteria with remediation guidance */ import { WCAGLevel } from '../types/wcag'; /** * WCAG Success Criterion detailed information */ export interface WCAGCriterion { /** Criterion number (e.g., "1.1.1") */ number: string; /** WCAG conformance level */ level: WCAGLevel; /** Criterion title */ title: string; /** Detailed description */ description: string; /** Intent and purpose */ intent: string; /** Who benefits from this criterion */ benefits: string[]; /** Common failure patterns */ commonFailures: string[]; /** Remediation guidance */ remediation: RemediationGuidance; /** Testing instructions */ testing: TestingGuidance; /** Code examples */ examples: CodeExample[]; /** Related success criteria */ relatedCriteria: string[]; /** Techniques and resources */ techniques: { sufficient: string[]; advisory: string[]; failures: string[]; }; /** Official WCAG reference URL */ wcagUrl: string; } /** * Remediation guidance structure */ export interface RemediationGuidance { /** Quick summary of how to fix */ summary: string; /** Detailed steps to remediate */ steps: string[]; /** Implementation difficulty */ difficulty: 'easy' | 'moderate' | 'complex'; /** Estimated time to fix */ estimatedTime: string; /** Tools that can help */ tools: string[]; /** Additional considerations */ considerations: string[]; } /** * Testing guidance structure */ export interface TestingGuidance { /** Manual testing steps */ manual: string[]; /** Automated testing tools */ automated: string[]; /** Screen reader testing */ screenReader?: string[]; /** Keyboard testing */ keyboard?: string[]; /** Visual testing */ visual?: string[]; } /** * Code example structure */ export interface CodeExample { /** Example type */ type: 'good' | 'bad'; /** Example title */ title: string; /** Code snippet */ code: string; /** Language */ language: 'html' | 'css' | 'javascript' | 'jsx' | 'vue' | 'angular'; /** Explanation */ explanation: string; } /** * Comprehensive WCAG 2.2 Success Criteria Database */ export declare const WCAG_DATABASE: Record<string, WCAGCriterion>; /** * Get WCAG criterion by number */ export declare function getWCAGCriterion(number: string): WCAGCriterion | undefined; /** * Get all criteria for a specific WCAG level */ export declare function getCriteriaByLevel(level: WCAGLevel): WCAGCriterion[]; /** * Search criteria by keyword */ export declare function searchCriteria(keyword: string): WCAGCriterion[]; /** * Get related criteria */ export declare function getRelatedCriteria(number: string): WCAGCriterion[]; /** * Get common issue patterns and their remediation */ export declare const COMMON_ISSUE_PATTERNS: { readonly 'missing-alt-text': { readonly criteria: readonly ["1.1.1"]; readonly severity: "serious"; readonly category: "images"; readonly title: "Images missing alternative text"; readonly quickFix: "Add descriptive alt attributes to images"; readonly codeExample: "<img src=\"chart.jpg\" alt=\"Sales increased 25% from Q1 to Q2\">"; }; readonly 'low-contrast': { readonly criteria: readonly ["1.4.3"]; readonly severity: "serious"; readonly category: "color"; readonly title: "Insufficient color contrast"; readonly quickFix: "Increase contrast between text and background colors"; readonly codeExample: "color: #333; /* Use darker colors for better contrast */"; }; readonly 'missing-labels': { readonly criteria: readonly ["3.3.2", "4.1.2"]; readonly severity: "serious"; readonly category: "forms"; readonly title: "Form controls without labels"; readonly quickFix: "Add descriptive labels to all form controls"; readonly codeExample: "<label for=\"email\">Email Address</label><input type=\"email\" id=\"email\">"; }; readonly 'keyboard-inaccessible': { readonly criteria: readonly ["2.1.1"]; readonly severity: "critical"; readonly category: "keyboard"; readonly title: "Elements not keyboard accessible"; readonly quickFix: "Ensure all interactive elements can be reached and activated with keyboard"; readonly codeExample: "<button onclick=\"action()\">Click me</button> <!-- Use button instead of div -->"; }; readonly 'missing-headings': { readonly criteria: readonly ["1.3.1", "2.4.6"]; readonly severity: "moderate"; readonly category: "structure"; readonly title: "Poor heading structure"; readonly quickFix: "Use proper heading hierarchy (h1, h2, h3) to organize content"; readonly codeExample: "<h1>Main Title</h1><h2>Section Title</h2><h3>Subsection</h3>"; }; }; //# sourceMappingURL=wcag-database.d.ts.map