Swipe to confirm and accessibility

I have a question about using a swipe functionality to confirm a booking, like answering the phone by sliding to answer (also as sliding to unlock). I am curious if this harms accessibility, say, if the user has VoiceOver activated. I would like to know if anybody has any experience developing this specific UI pattern related to it being too cumbersome for users with a disability or if this is just fine to use.

Replies

Hey there! Thanks for considering the accessibility usability for your app. Assistive technologies like VoiceOver, Switch Control, and even Voice Control drastically change how people physically interact with their device. VoiceOver being for people with visual disabilities like blindness, and Switch Control and Voice Control for people with impairments affecting their mobility, often times letting them interact with their phone without ever touching it. Imagine that someone with limited movement might not be able to easily perform a gesture like swipe to confirm booking. Apple's assistive technologies can help someone perform gestures like this through the feature itself, but there are absolutely steps you can and should take to help make this easier for accessibility users.

There are two API's worth calling out to help for this use case, accessibilityActivate and accessibilityCustomActions. Let's start with accessibilityActivate. This is a method you can override on any view to run custom logic when this element is activated/selected with an assistive technology like VoiceOver, Switch Control, etc. Let's say you have a method which handles the booking confirmation in response to the swipe gesture, handleBookingConfirmation(). You would call this method inside accessibilityActivate to run the same logic to confirm the booking without requiring them to perform the swipe.

accessibilityCustomActions is a property you can override on any view to return a collection of actions that users of assistive technologies can perform on a single element. For your use, you would just create and return 1 action, "Confirm Booking", and the action handler could call your helper handleBookingConfirmation().

For either of these approaches, you want to make sure the view is an accessibility element itself by returning true for isAccessibilityElement. Here are some links to APIs I mentioned and also a WWDC video which talks about the usage of accessibilityCustomActions.

https://developer.apple.com/documentation/objectivec/nsobject/1615165-accessibilityactivate

https://developer.apple.com/documentation/objectivec/nsobject/1615150-accessibilitycustomactions

https://developer.apple.com/documentation/objectivec/nsobject/1615141-isaccessibilityelement

https://developer.apple.com/videos/play/wwdc2019/250/