Skip to content

feat(compiler): add compile-time accessibility checking#5

Merged
wrxck merged 2 commits intomainfrom
feat/compiler-a11y
Feb 11, 2026
Merged

feat(compiler): add compile-time accessibility checking#5
wrxck merged 2 commits intomainfrom
feat/compiler-a11y

Conversation

@wrxck
Copy link
Owner

@wrxck wrxck commented Feb 11, 2026

Summary

  • Adds checkA11y(ast, options?) — walks template AST and returns A11yWarning[]
  • 10 rules: img-alt, click-keyboard, anchor-content, form-label, no-distracting, heading-order, aria-role, no-positive-tabindex, media-captions, anchor-valid
  • Integrated into compile() pipeline — warnings appear in CompileResult.a11y
  • Configurable: disable specific rules via A11yOptions.disable, or disable entirely with a11y: false
  • 43 tests covering all rules, edge cases, and compile() integration

Test plan

  • All 511 tests pass (existing + 43 new)
  • Build succeeds cleanly

Matt Hesketh added 2 commits February 11, 2026 17:15
Add a post-parse a11y analysis pass that checks template ASTs for
common accessibility violations and emits warnings. Integrated into
the compile() pipeline — warnings are returned in CompileResult.a11y.

10 rules implemented:
- img-alt: <img> must have alt attribute
- click-keyboard: non-interactive elements with @click need keyboard support
- anchor-content: <a> must have content or aria-label
- form-label: form elements need id/aria-label/aria-labelledby
- no-distracting: <marquee>/<blink> are forbidden
- heading-order: heading levels must not skip
- aria-role: role values must be valid WAI-ARIA 1.2
- no-positive-tabindex: tabindex should not be positive
- media-captions: <video>/<audio> should have <track>
- anchor-valid: <a> should have href

Configurable via CompileOptions.a11y (disable rules or turn off).
43 new tests covering all rules, edge cases, and integration.
@wrxck wrxck merged commit dd51cb5 into main Feb 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant