android-accessibility-validator
Accessibility Validator (Android)
Checklist
TalkBack
- Interactive elements have
contentDescriptionvia semantics - Decorative elements:
Modifier.semantics { invisibleToUser() } - Related elements:
Modifier.semantics(mergeDescendants = true) - contentDescription is localized
- Use
Role(e.g.,Role.Button,Role.Switch,Role.Checkbox) viasemantics { role = Role.Button } - Provide
stateDescriptionfor toggles/switches (e.g., "On", "Checked") - Mark headings with
semantics { heading() } - Use
onClickLabelfor custom action descriptions - Control traversal order with
isTraversalGroupandtraversalIndexwhen default order is insufficient - Override defaults with
clearAndSetSemantics { ... }for complex custom components
Dynamic Text
- Use
spfor text sizes, notdp - Use
MaterialTheme.typographyscales - Layout adapts to large text sizes
- Support pinch-to-zoom scalable content with
Modifier.transformable+ state updates where appropriate
Color Contrast
- Text: 4.5:1 (normal), 3:1 (large 18sp+)
- Use Material Theme semantic colors
- Color not sole indicator
Touch Targets
- Minimum 48dp
- Use
Modifier.minimumInteractiveComponentSize()
Testing
- Manual testing with TalkBack enabled
- Automated checks via
enableAccessibilityChecks()in Compose tests
Quick Fixes
| Issue | Fix |
|---|---|
| No contentDescription | Modifier.semantics { contentDescription = "desc" } |
| Decorative | Modifier.semantics { invisibleToUser() } |
| Group | Modifier.semantics(mergeDescendants = true) |
| Small target | Modifier.size(48.dp) |
| Fixed font | Use MaterialTheme.typography.bodyLarge |
| Missing role or state | Modifier.semantics { role = Role.Switch; stateDescription = "On" } |
| Wrong traversal order | Modifier.semantics { isTraversalGroup = true; traversalIndex = 1 } |
Severity
- 🔴 Critical: Blocks accessibility
- 🟡 Moderate: Reduces usability
- 🟢 Minor: Enhancement
More from desquared/agents-rules-skills
shared-bug-investigation
Scientific method expert for systematic bug investigation and root cause analysis. Use when users report bugs, crashes, unexpected behavior, or debugging requests. Applies hypothesis-driven investigation, controlled experiments, and rigorous validation across any programming language or platform.
23android-performance-profiler
Identifies potential performance bottlenecks in Jetpack Compose code including expensive recompositions, unnecessary redraws, and memory issues. Use when code involves lists, animations, complex UI, or when the user asks about performance optimization.
19ios-swiftui-architecture-review
Analyze SwiftUI view hierarchies and suggest MVVM or other architectural improvements. Use when **reviewing existing SwiftUI code**, creating new SwiftUI components, analyzing view structure, or when the user asks about SwiftUI architecture patterns. Best for code review and refactoring guidance.
13android-compose-architecture-review
Analyze Jetpack Compose UI hierarchies and suggest MVVM/MVI or other architectural improvements. Use when reviewing existing Compose code, creating new Compose components, analyzing composable structure, or when the user asks about Compose architecture patterns. Best for code review and refactoring guidance.
13android-kotlin-api-design-reviewer
Review function and class interfaces for Kotlin Coding Conventions compliance. Use when creating public APIs, reusable components, library interfaces, or when the user asks for API design review or Kotlin naming conventions.
11flutter-performance-optimizer
Use when Flutter UI has jank, slow scrolling, excessive rebuilds, or memory leaks. Also use when optimizing lists, animations, or complex widget trees, or when the user asks about Flutter rendering performance.
10