Browse mode cursor placed incorrectly despite focus when leaving dialog which hides outside content #3145

Closed
nvaccessAuto opened this Issue Apr 10, 2013 · 9 comments

2 participants

@nvaccessAuto

Reported by detlev on 2013-04-10 07:47
In this custom dialog example

http://3needs.org/en/testing/code/role-dialog-3.html

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).

@nvaccessAuto

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:

  1. Press tab until focus is moved to the "click me for an alert" button, and activate this button. The button will function correctly (an alert will show).
  2. Shift-tab to the checkbox labeled "Hide the section below from AT and disable controls". Check the box. This applies aria-hidden="true" to the div element wrapping the button that was clicked before. The button itself will also be disabled.
  3. Uncheck the checkbox again. This will set aria-hidden="false" and the button will be enabled again.
  4. Press tab to move focus back to the "click me" button. NVDA will now start announcing the document title, but the button is not announced even though it receives keyboard focus. Pressing Space will not activate the button (i.e. the alert will not show). Even though the button has keyboard focus, NVDA seems to act like it doesn't. I'm some cases it will reset focus to the start of the document. If you press tab or shift tab a few times to move focus back to the button, NVDA will start announcing it properly again and the button can be activated again

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).

@nvaccessAuto

Attachment test_case_virtual_buffer_aria_hidden.html added by hhillen on 2013-10-10 16:02
Description:
Test case for Ticket #3145

@nvaccessAuto

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. :)
Changes:
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"

@nvaccessAuto

Comment 5 by James Teh <jamie@... on 2013-10-15 00:17
In [022321b]:
```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).
Re #3145.

@nvaccessAuto

Comment 6 by James Teh <jamie@... on 2013-10-15 00:18
In [4afff04]:
```CommitTicketReference repository="" revision="4afff045fc8364bd41473750df7d9fb96f6f463c"
Merge branch 't3145' into next

Incubates #3145.

Changes:
Added labels: incubating
@nvaccessAuto

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.
Changes:
Milestone changed from None to next

@nvaccessAuto

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!

@nvaccessAuto

Comment 9 by Michael Curran <mick@... on 2013-10-28 23:19
In [d119223]:
```CommitTicketReference repository="" revision="d11922342afc7656659022f89021912cd1942ac6"
Merge branch 't3145'. Fixes #3145

Changes:
Removed labels: incubating
State: closed
@nvaccessAuto

Comment 10 by mdcurran on 2013-10-28 23:20
Changes:
Milestone changed from next to 2013.3

@jcsteh jcsteh was assigned by nvaccessAuto Nov 10, 2015
@nvaccessAuto nvaccessAuto added this to the 2013.3 milestone Nov 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment