Skip to main content
Logo Appt Light

Accessibility dialog on iOS

A dialog overlays the screen and offers one or more actions to proceed. Dialogs should always include a close button to make them accessible for users of assistive technologies. Furthermore, the focus of assistive technologies should be trapped inside the dialog while it's visible.

On iOS, you can show alerts by using UIAlertController. Set the style to alert to display a dialog. You should always add a close action in the cancel style. The focus of assistive technologies is automatically trapped inside the alert while it's visible.

let alert = UIAlertController(
  title: "Confirm Appt membership?", 
  message: "Your bank account will be billed.", 
  preferredStyle: .alert
)

alert.addAction(UIAlertAction(title: "Proceed", style: .default, handler: { action in
  // Proceed
}))

alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { action in
  // Cancel
}))

present(alert, animated: true)

Feedback?

Let us know!