Requires the accessibility layer for accurate results. Learn how to load the accessibility layer here.
Focusable Text identifies text elements and ensures they are available to VoiceOver.
People using VoiceOver with blindness or low-vision are most impacted. Text elements should be focusable so a screen reader can relay information to the end-user.
- Turn on VoiceOver
- Attempt to focus the text element
- One of the following will occur:
- Inaccessible: Text element will not be focusable.
- Accessible: Text element is focused by VoiceOver.
An issue found by this rule is caused by a text element not being marked as an accessibility element. If there is a focusable parent view, then text does not need to be individually focusable. An example of this would be a label for a control, or a control's describing text.
To fix in Storyboard:
- Navigate to the text element.
- Confirm that the Inspectors Panel is visible.
- Select the Identity Inspector.
- Under "Accessibility", select the "Enabled" checkbox.
To fix in Code:
Make the text element focusable by VoiceOver:
label.isAccessibilityElement = true
In SwiftUI, text elements are accessible by default. You'll want to confirm the text is meaningful and provides context. Don't turn off its accessibility by using the accessibility hidden view modifier.