24.6 · Building and testing accessible components
The first pass covered what VoiceOver says. This section is about the code you write for it: what you can and cannot test headlessly, custom-drawn controls, modal screens and the gestures VoiceOver reserves, and how to control pronunciation.
Mental model. Standard controls are accessible only while an assistive technology is running; everything custom needs explicit elements, frames, traits and, where speech matters, speech attributes.
Components
Defaults, custom drawing, modality, pronunciation.
- What can a unit test assert about accessibility properties, and why does a standard UIButton report no label in a plain test process?
Reading accessibility properties from a unit test or a command-line process is less informative than it looks. In the check below (run in the iOS Simulator… - How do you make a custom-drawn control (a canvas, a chart or a hand-built segmented control) accessible with UIAccessibilityElement?
A view that draws its own parts with Core Graphics has one view and no sub-views, so the accessibility tree has nothing to expose. The pattern is a container… - How do you make a custom modal screen work with VoiceOver: modal views, the escape gesture and the magic tap?
A visual modal (a custom dialog, a popup menu, a bottom sheet you built yourself) dims what is behind it, but VoiceOver does not see dimming: it will happily… - How do you control how VoiceOver pronounces text: spell-out, language, punctuation and IPA?
VoiceOver speaks with the voice and language of the user’s settings, which is wrong for part of your text more often than you would expect: an order code…
More in Accessibility & localization
- 24.1 · VoiceOver, accessibility elements and the other ways people use an app
- 24.2 · Dynamic Type, display settings, contrast and touch targets
- 24.3 · Right-to-left layout, bidirectional text and number systems
- 24.4 · Testing localisation, and sorting, calendars and names by locale
- 24.5 · Auditing and testing accessibility, and making it a bar, not a backlog
- 24.7 · Adaptive colour, font fallback and mirrored drawing
- 24.8 · Language matching, plural rules, string catalogs and Info.plist strings
- 24.9 · Unicode equivalence, word boundaries and regional defaults