flutter_a11y_lens 0.0.1
flutter_a11y_lens: ^0.0.1 copied to clipboard
Live accessibility auditing for Flutter: inspects the running widget tree and flags WCAG violations in real time, with an on-screen debug overlay.
0.0.1 #
- Phase 1: internal
ElementTreeWalkerfor capturing live widget tree snapshots (widget type, global bounds, explicitSemantics), plus theA11yRule/A11yViolation/A11ySeveritydata model checks will build on. - Phase 2:
ContrastRule(WCAG AA/AAA text contrast, with an ancestor background lookup) andTapTargetSizeRule(48x48dp minimum, configurable size and widget set), backed by the pure-mathColorContrastutility. No public overlay yet. - Phase 3:
A11yLensOverlay, the debug overlay — wraps the app, re-walks after every frame, and draws a tap-to-inspect outline over each violation. No-op in release builds.A11yViolationgained value equality so the overlay's selection survives re-walks producing fresh instances of the same issue. - Phase 4:
SemanticsTreeWalker, reading the realSemanticsNodetree rather than theElementtree, plusSemanticLabelRuleandFocusOrderRulebuilt on it — catching widgets that set semantics via a customRenderObject(not just an explicitSemanticswidget), same as a screen reader would encounter them. Both are on by default inA11yLensOverlay, which now manages theSemanticsHandlethey need. - Phase 5:
A11yReport(JSON/Markdown export, baseline diffing vianewViolationsComparedTo) andpackage:flutter_a11y_lens/testing.dart'sexpectNoA11yViolations, a headlessflutter testharness for CI.A11yViolation.widgetTypechanged fromType?toString?so violations round-trip losslessly through JSON (aTypecan't be reconstructed from a string) — a breaking change for anyone matching on it directly. - Renamed the package from
a11y_lenstoflutter_a11y_lens: pub.dev already has an unrelated package published under the former name. - Fixed
SemanticsTreeWalker.walk(context)to actually scope tocontext's subtree, matchingElementTreeWalker. It previously ignoredcontextfor finding the tree root and always walked the whole view — harmless forA11yLensOverlay(which only avoided self-flagging viaexcludeFromSemantics, not scoping) but silently broke thefinder/contextscopingA11yReport.generateandexpectNoA11yViolationspromise for semantics-based rules. - Phase 6: the example app now has a live before/after toggle (
SwitchListTile) demonstrating one deliberate violation per rule, each isolated in its own card, fixed in place, plus a regression test proving the fix genuinely clears them. - Fixed the example app's
SemanticLabelRuledemo card: its unlabeledGestureDetectorhad no semantics boundary of its own, so its tap action merged upward into the card's title/description text — which gave the merged node a non-empty "label" (the surrounding paragraph) and made the violation undetectable. Wrapped it in a tightSemantics(container: true)boundary. - README rewritten with full installation/usage/CI instructions, a rules reference table, and screenshots of the example app's overlay and tap-to-inspect popovers.