Search code examples
iosvoiceoveruiaccessibility

iOS Voiceover reads from covered UIWindow


I have the following setup:

  • UIWindow 0, windowLevel 0, rootController is the main part of the app, and takes up the whole screen, isHidden is false, is not key window
  • UIWindow 1, windowLevel 1, rootController is an auxiliary screen, and takes up the whole screen with no transparency, isHidden is false, is key window

Problem:

When voiceover is enabled and I touch an area in window 1 that doesn't have an element that can be interacted with, but where window 0 does have such an element, it will select and read the element in window 0, even though window 0 is not visible at all.

Is there something I'm missing?


Solution

  • Turns out there are 2 ways to fix this:

    1. Set accessibilityElementsHidden to true on window 0. Not ideal because it has to be restored when window 1 goes away.
    2. Set accessibilityViewIsModal to true on window 1. All windows are siblings so this will ignore window 0 for accessibility purposes. I don't think this affects special windows like the status bar and keyboard. This is likely the best solution.