/** * Development-time accessibility audit utility. * * Scans DOM elements for common accessibility issues such as missing * alt text on images, missing labels on form inputs, empty links/buttons, * and incorrect ARIA usage. * * @module bquery/a11y */ import type { AuditFinding, AuditResult, AuditRule, AuditSeverity } from './types'; /** * The complete, frozen catalog of rules the runtime audit checks, each mapped * to a WCAG 2.1 success criterion and annotated with what it **cannot** detect. * * This is the audit's documented scope. The runtime audit catches structural, * statically-determinable issues only; it does **not** evaluate colour * contrast, focus order, reading order, motion, timing, or any criterion that * requires rendering, computed styles, or human judgement. Treat it as a fast * development signal, never as a substitute for a manual or professional audit. * * @see {@link auditA11y} */ export const auditRules: readonly AuditRule[] = [ { rule: 'img-alt', wcag: '1.1.1', severity: 'error', description: 'Images expose an `alt` attribute.', cannotDetect: 'Whether the alt text is accurate or meaningful.', }, { rule: 'img-decorative', wcag: '1.1.1', severity: 'info', description: 'Empty-alt images are flagged as possibly decorative.', cannotDetect: 'Whether the image is genuinely decorative.', }, { rule: 'input-label', wcag: '4.1.2', severity: 'error', description: 'Form controls have an accessible name (`