Skip to main content

Accessibility

Semantic annotations​

Use Semantics widgets to annotate interactive elements that lack an implicit label — icon-only buttons, image buttons, and custom controls:

foo.dart
Semantics(
label: 'Close dialog',
button: true,
child: ZetaIconButton(icon: ZetaIcons.close, onTap: onClose),
)

Set excludeFromSemantics: true on purely decorative widgets to keep the accessibility tree clean.

Touch targets​

All tappable targets must meet the minimum touch target size:

  • Android: 48x48 logical pixels (androidTapTargetGuideline)
  • iOS: 44x44 logical pixels (iOSTapTargetGuideline)

Use ZetaSpacing tokens — the standard sizes are calibrated to meet these requirements.

Colour contrast​

Use ZetaColors — semantic colors already satisfy WCAG AA contrast in all four theme modes (light, dark, high-contrast light, high-contrast dark). Do not apply additional opacity to text without re-checking contrast.

Focus​

Never suppress keyboard focus for interactive components. Focus traversal must work correctly in all components.

Testing​

We should always have tests for accessibility guidelines. See Testing for the full guide on writing tests.