Touch Target Spacing
Actionable controls should have a minimum dimension of 24 x 24 points or must be positioned so that if a circle with a diameter of 24 points is placed on the center of control, the circle will not intersect with another target or with the circle for another target.
Impact
On a touch device, small controls are a usability issue for everyone. Additionally, people experiencing motor limitations have increased difficulty interacting with small targets.
What's the difference?
You may have noticed this rule is very similar to our Touch Target Size rule! Touch Target Spacing aims for WCAG AA compliance, while Touch Target Size aligns with Apples recommendation of 44 by 44 points. We highly recommend supporting both rules as compliance with Apple's guidelines will ensure there are no issues when submitting to the App Store.
Confirmation
Run the application within Xcode and navigate to the screen containing the active control to test.
- Within Xcode, select Debug View Hierarchy
- Select the control to test
- Open the inspector panel if not visible
- Select the size inspector
- Observe the width and height of the selected control
- One of the following will happen:
- Accessible: The view will be larger than the minimum requirement and not have overlapping views that cause the available target to be smaller than 24x24.
- Accessible: The view will be smaller than the 24x24 minimum, but the padding around the view will make the button have enough space to be tapped reliably by users.
- Accessible : Sliders maintain a space of 24pt along the length of the control.
- Inaccessible : The view will be smaller than the 24x24 minimum and have insufficient padding between itself and nearby views.
- Inaccessible : There is another interactable view that reduces the tappable area of the tested view below this minimum threshold.
How to Fix
An issue found by this rule occurs when the frame
of an active control does not have a height and width of 24pt or more.
- Setting the minimum height and width of the view to 24x24pt.
- Adjust neighboring interactive views to allow for ample space between interactive components.
- Remove obstructions around sliders.
- Add a margin around interactive views.
UIKit
In storyboard:
- Navigate to the active control
- Open the inspector panel if not visible
- Select the size inspector
- Under
View
, update thewidth
andheight
parameters to be a minimum of 24pt.
In code:
Update the width
and height
of the active control's frame
to be a minimum of 24pt.
let button = UIButton(frame: CGRect(x: 10, y: 20, width: 24, height: 24))
SwiftUI
Use a frame modifier on the view to set the proper height and width.
Button("Next")
.frame(minWidth: 24, minHeight: 24, alignment: .leading)