Accessibility / VoiceOver considerations when using multiple UIWindows in iOS applications

This post follows on from my previous post Using multiple UIWindows in iOS applications but I will cover the specific issue I encountered when VoiceOver mode is on.

I have been working on an application that makes use of multiple UIWindows within its view heirachy, mostly because it is quite a secure application and so the easiest way for us to block access to the app is to present a UIWindow above all other windows in the app.

Happy day scenario (VoiceOver disabled):

I am currently presenting a UIAlertView to the user and for whatever reason the app gets interrupted and goes into the background.  When this happens I put up our UIWindow (lets call it our security window) so you can no longer interact or see any part of the app, including the currently displayed alert.

When the user resumes the app from the background the security window is displayed and functions as expected.  We can dismiss it and low and behold our UIAlertView is there and we are all happy.

Accessibility scenario (VoiceOver enabled):

Same as before we present a UIAlertView to the user (accessibility does its thing and reads it out) and for whatever reason the app gets interrupted and goes into the background.  When this happens I put up our security window so you can no longer interact or see any part of the app, including the currently displayed alert.

Now when the user resumes the app from the background the security window is displayed and is interactive as expected however the UIAlertView that is displayed but not seen is actually read out!!!  This is really annoying because you cant interact with that alert view and you can’t see it.

My observations regarding how iOS handles UIAlertViews when VoiceOver is enabled

It appears to me that regardless of the windowLevels you set on your windows, if you are displaying a UIAlertView anywhere in your app and you cover it with a UIWindow and resume from the background.  Apple take the initiative and assume that the UIAlertView is super important so they read it out using something like

UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, <Text from UIAlertView>);

even though you can not actually see the UIAlertView or interact with it for that matter!

Furthermore I noticed that when the app resumes from the background if there is any UIAlertView it will make it the keywindow whilst VoiceOver is running and once it has finished reading out the alert it is more than happy to resign itself again.

If anyone has any further insight into this issue drop me a line as I would be interested to know how if at all possible you managed to resolve this issue.

Leave a Reply