-
Notifications
You must be signed in to change notification settings - Fork 3.1k
A Brief Overview of Accessibility
Firefox iOS should strive to implement accessibility for new features, as well as add missing accessibility for existing features. This document will show you the few easy steps to take do ensure that this is done well.
Many Apple UI elements have accessibility built in (UIButton, UISwitch, UILabel, etc). This means that their isAccessibiltyElement property is set to true by default. If you're creating an element and want it to be accessible for VoiceOver, you want to make sure to
enable this.
Many Apple UI elements have some default behaviour for reading accessibility. For example, a UILabel will read its contents. However, some elements may not have text, or you wish for VoiceOver to read something specific. This is where .accessibilityLabel comes into play. Anything set here is what VoiceOver will read.
Many standard Apple UI elements have specific traits enabled on them. For example, a UIButton will read "Description of button, button. That "button" is added by the UIAccessibilityTrait.buttonthat aUIButtonhas. If you wish to set specific traits on an element, you would do this using the.accessibilityTrait` call on that object, and then either pass in a singular
One awesome feature of iOS is that it has image recognition. So after it reads your accessibilityLabel content, it will follow with a description of the image. This may be useful in many aspects of web browsing, but, if you're trying to control how your UI is represented by VoiceOver, you may want to disable this. This is done using the .accessibilityTraits = .none on the UIImageView itself.
This is a confusingly named trait of any UI object. This is an identifier used for UI tests, generally, and is not part of user facing accessibility features for iOS. UI should be built in a testable way, so accessibilityIdentifiers should be added to required objects. An
easy way or organizing reusable identifiers can be found in our AccessibilityIdentifiers struct.