In ScrollView

Link to In ScrollView copied to clipboard

WCAG 2.0 - 1.4.4 AA Impact - Serious

Identifies text elements and ensures that an ancestor of the element is within a scroll view.

Impact

People utilizing Dynamic Type on iOS are most impacted. When Dynamic Type is on, text sizes can be increased and may move off-screen. If the text is not within a scroll view, the information will not be available to the end-user. Scroll views are a great way to support various screen sizes, ensuring all content is accessible.

Confirmation

  1. If the content on the page takes up less than one screen, make all text larger with Dynamic Type:
    • If using a simulator:
      1. Open Accessibility Inspector
      2. On the top-left corner of the inspector, change the device from your Mac to the iOS simulator
      3. Select the "Settings" button in the top-right corner of the inspector
      4. Under "Font Size", move the slider to a larger setting
    • If using an iOS 13.0+ device:
      1. Open up Settings
      2. Select "Accessibility"
      3. Select "Display & Text Size"
      4. Select "Larger Text"
      5. Move the slider at the bottom of the page to a larger setting
  2. Attempt to scroll to the text element
    • Inaccessible: You were unable to scroll to the text element.
    • Accessible: You were able to scroll to the text element.

How to Fix

An issue found by this rule is caused by not using a UIScrollView or ScrollView in your application for text elements.

Note: If text is part of a pinned element, such as UINavigationBar, UITabBar, etc, UILargeContentViewer should be used instead.

UIKit

Add a UIScrollView as the parent view of your screen's elements. This tutorial from Ray Wenderlich offers a great guide.

SwiftUI

Adding text within a ScrollView:

     var body: some View {
        ScrollView {
            VStack  {
                HStack {
                    Text("This text is in a scroll view")
                        .padding()
                }
            }
        }
    }