3
votes

On an iPad, you can use controller.modalPresentationStyle = UIModalPresentationFormSheet to show a centered modal on the screen. A common technique is to allow the user to dismiss the modal by clicking "outside" or "behind" it. This is covered in numerous other answers (Iphone SDK dismissing Modal ViewControllers on ipad by clicking outside of it, Dismiss modal view form sheet controller on outside tap), usually by adding a tap gesture to the view's UIWindow.

My question is, how do I make this accessible to users in VoiceOver mode? The native action sheets allow clicks outside the sheet to dismiss, and even prompt the user, saying "double tap to dismiss popup window". How can I expose the UIWindow tap gesture in the same way?

2
One option is to implement the "global escape gesture" (as described in ronnqvi.st/adding-accessible-behavior) via accessibilityPerformEscape. However this is not very discoverable if the user doesn't know about the gesture already.tmm1
FYI - the default ability to dismiss an action sheet or other popovers by tapping outside of them is built into controllers presented with the modal presentation style of "popover".rmaddy
@rmaddy is correct - the system provides that ability automatically, and the form sheet style does not support tap outside to dismiss (not for VO users or for non-VO users)Jordan H

2 Answers

3
votes

There is basically no way to do this with the FormSheet presentation. You can use the Popover presentation, but it behaves differently in some cases.

My solution was to check UIAccessibilityIsVoiceOverRunning() and add an extra close button element to the top of FormSheet that can be clicked via voiceover. I also implemented accessibilityPerformEscape for the global escape gesture.

3
votes

From Apple:

https://support.apple.com/guide/iphone/learn-voiceover-gestures-iph3e2e2281/ios

Dismiss an alert or return to the previous screen: Two-finger scrub (move two fingers back and forth three times quickly, making a “z”).

If the modal sheet is opened, we can prompt the user to "make a z gesture" to go back.