Reported by detlev on 2013-04-10 07:47
In this custom dialog example
a link with role button ("Display a dialog") displays a custom dialog (a hidden div at the start of the page source code).
The page background (the rest of the page) is hidden by setting the dive that encloses it to aria-hidden=true. (This happend to improve focus handling in iOS/VoiceOver).
Closing the dialog sets aria-hidden to false and then restores the focus. This however is not understood by NVDA - the focus moves insteasd to the start of the page. The example works fine in OSX / VoiceOver and JAWS.
Apparently, there is a delay in NVDA when setting aria-hidden=false since the resoration of focus in the next line of script fails (possibly because NVDA does not 'see' the background which contains the button that should be focused on closing the dialog).
Comment 2 by hhillen on 2013-10-10 16:01
I've run into this issue as well, and have spent the last few days trying to find an acceptable workaround without success.
The problem does not seem to be related to timing though. You can move focus into a role="dialog" container, set aria-hidden="true" on the main contents of the page, then set aria-hidden="false" again, wait ten seconds, move focus back to the button that triggered the dialog, and the problem will still occur.
The issue only happens when focus is moved from within a role="dialog" container to an element inside a container that previously had aria-hidden="true".
I've attached a test case that simplifies the problem. To use this test case to the following:
Note that taking out the disabling off the button from this scenario will have no effect on this issue. Neither does completely removing the aria-hidden attribute (as opposed to just setting it to "false"), or any timeouts you can think of.
Together with the fact that NVDA re-announces the document title whenever focus is moved out of a dialog (i'm not sure if this is a bug or a feature, but it's very annoying and not helpful) and the fact that NVDA will disable browse mode inside dialogs (which I understand is conforming the ARIA spec, but simply doesn't work for a lot of real life dialog use cases that happen to have a lot of static content), this issue makes the dialog role a very hard sell when trying to support NVDA. It would be great if this could be fixed.
Another demo showing this issue with a basic dialog can be found here: https://dl.dropboxusercontent.com/u/3075595/cgi/CGIFix/docdialog.html . Note that in this demo the dialog contents have been wrapped in a role="document" role to allow browse mode (which I know is wrong and a hack).
Attachment test_case_virtual_buffer_aria_hidden.html added by hhillen on 2013-10-10 16:02
Test case for Ticket #3145
Comment 4 by jteh on 2013-10-14 06:45
As Hans observes, this has nothing to do with timing after all. It occurs because NVDA avoids moving the cursor if focus is fired on the same object that was focused before leaving the document. This is done to avoid bouncing the cursor back to the focus when switching out of the document. Unfortunately, moving into a dialog is currently treated as leaving the document, so restoring focus gets ignored. I'm trying to dream up a fix at the moment. :)
Changed title from "aria-hidden delay when set to false, prevents scripts from restoring focus" to "Browse mode cursor placed incorrectly despite focus when leaving dialog which hides outside content"
Comment 5 by James Teh <jamie@... on 2013-10-15 00:17
```CommitTicketReference repository="" revision="022321bf2437b7f53fa769b9e2a384842d6beb2e"
The browse mode cursor is no longer positioned incorrectly when leaving a dialog or application inside the document.
This occurred because VirtualBuffer ignores a focus event if it is for the same object that was last focused. This is to avoid mistakenly moving the cursor when switching applications, tabs, etc.
Now, such a focus event is only ignored if the document is being entered from outside (as opposed to returning from a dialog or application inside).
Comment 6 by James Teh <jamie@... on 2013-10-15 00:18
```CommitTicketReference repository="" revision="4afff045fc8364bd41473750df7d9fb96f6f463c"
Merge branch 't3145' into next
Added labels: incubating
Comment 7 by jteh on 2013-10-15 00:21
I've tested this myself and it seems to work, but it'd be great if others can verify. The fix will be available in the 15 Oct "next" snapshot.
Milestone changed from None to next
Comment 8 by hhillen on 2013-10-15 10:42
Just tried it out with today's snapshot, and he issue is resolved for me. Thanks for the quick fix!
Comment 9 by Michael Curran <mick@... on 2013-10-28 23:19
```CommitTicketReference repository="" revision="d11922342afc7656659022f89021912cd1942ac6"
Merge branch 't3145'. Fixes #3145
Removed labels: incubating
Comment 10 by mdcurran on 2013-10-28 23:20
Milestone changed from next to 2013.3