iOS Accessibility traits
Apple has made accessibility part of the iOS app SDK. With integrated screen magnification and the VoiceOver screen reader available on all recent iOS devices, it’s an ideal platform for great accessibility.
In iOS App Accessibility we touched on some of the basic features of the SDK. Standard UI controls are accessibility enabled by default, come with helpful labels and optional descriptions, as well as pre-defined accessibility traits.
A trait describes a characteristic of something. In this case, an accessibility characteristic of a UI control.
Standard UI controls have their accessibility traits pre-defined. If you’re developing your own controls though, you’ll need to assign the relevant accessibility traits yourself.
Accessibility traits are roughly divided into two groups. The first group relates to the type of control you’re using. There are four traits to choose from, but you should only choose one for your control.
- Button: Means the control is a button or behaves like a button;
- Link: Means the control is a link, particularly where it causes a URL to open;
- Search field: Means a string can be entered (or chosen) and when submitted causes a set of search results to be produced;
- Keyboard key: Means that the control is a key or behaves like a keyboard key.
The second group relates to the way the control behaves. There are seven traits in this group, but you should only choose one for your control.
- Static text: Indicates the control is static text that VoiceOver can read, but not interact with;
- Image: Indicates the control is a graphic (so a helpful accessibility label is essential);
- Play sound: Indicates the control will play a sound, enabling VoiceOver to moderate volume levels for other sound or speech in use at the time;
- Selected: Indicates that the control is selected, enabling VoiceOver to know which is the currently active control in the UI;
- Summary: Indicates the control provides a summary of the app, which is read automatically by VoiceOver when the app is opened;
- Updates frequently: Indicates the control updates too frequently for Voiceover to keep pace, enabling VoiceOver to poll the control at appropriate time intervals instead;
- Not enabled: Indicates the control is temporarily unavailable, and cannot be interacted with.
All of the above traits can be set through the Interface Developer. There are also a couple of traits that you can set programmatically as well.
- Starts media session: Indicates that the element initiates a session when it’s activated that should cause VoiceOver to silence;
- Adjustable: Indicates that the element can be moved through a range of positions (or values), enabling VoiceOver to notify the user that repeated interaction with the element causes its value to change accordingly.
With the appropriate accessibility traits defined, VoiceOver is able to treat the control in the right way, and make the right information available to the user.