nvaccess / nvda

NVDA, the free and open source Screen Reader for Microsoft Windows
https://www.nvaccess.org/
Other
2.12k stars 637 forks source link

NVDA announces out of context element when removing aria-hidden and restoring focus from a dialog #11237

Open majornista opened 4 years ago

majornista commented 4 years ago

Steps to reproduce:

  1. Open test case at https://codepen.io/mijordan/live/qBbdWxN
  2. Click the button labeled "Add Delivery Address"
  3. When the dialog opens, press Escape key to close the dialog, which should restore focus to the "Add Delivery Address" button.

Actual behavior:

"heading level 2 Example" is announced by NVDA before announcing the button that receives focus, because the landmark containing the heading it has been unhidden by removing the aria-hidden attribute from it.

Expected behavior:

One would expect only the element receiving focus to be announced.

In this example, it isn't horrible that NVDA announces "heading level 2 Example" before the element receiving focus, because the element receiving focus is in the same context as the landmark. But, in our application, we have encountered cases where content from an unrelated landmark with role="complimentary" is announced before the element receiving focus.

If we do not use aria-hidden to hide content underneath the dialog, the problem goes away, as is the case with the Modal Dialog Example from WAI-ARIA Authoring Practices 1.2.

System configuration

NVDA installed/portable/running from source:

https://www.nvaccess.org/files/nvda/releases/2020.1/nvda_2020.1.exe

NVDA version:

2020.1

Windows version:

Windows 10 Enterprise Version 10.0.18363 Build 18363

Name and version of other software in use when reproducing the issue:

Chrome Version 81.0.4044.138 (Official Build) (64-bit), Firefox 76.0.1 (64-bit) Edge Chromium Version 81.0.416.77 (Official build) (64-bit)

Other information about your system:

Other questions

Does the issue still occur after restarting your computer?

Yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

If addons are disabled, is your problem still occuring?

Did you try to run the COM registry fixing tool in NVDA menu / tools?

No

Adriani90 commented 4 years ago

I agree this can be really annoying, especially if the title of the landmark or the grouping is very long. I expect to hear the title of the landmark and the grouping either when navigating into it with quick navigation keys, with arrow keys or with tab and shift+tab, but not when closing a dialog because in that case I know that the focus will be on the same element as before opening the dialog. cc: @jcsteh, @aleventhal, @ObjectInSpace

ObjectInSpace commented 4 years ago

In Firefox, NVDA says "in this example, uses the" after pressing escape. JAWS behaves as expected.

Adriani90 commented 1 year ago

@majornista it seems we need a new minimal test case. With the test case provided in the issue description, it is no longer possible to reproduce this issue because

  1. Focus is not redirected to the dialog when pressing enter on the add delivery address button
  2. Navigating to a dialog with focus mode and pressing escape does not close the dialog.

Please provide a new test case.

majornista commented 1 year ago

@Adriani90 I believe I have restored the functionality for the Codepen example: https://codepen.io/mijordan/live/qBbdWxN. The urls for CSS and Javascript resources imported from the WAI-ARIA Authoring Practices Guide Modal Dialog Example changed, so the modal dialog was no longer working as expected. I've updated the urls for these resources and can still reproduce the bug as described.

Adriani90 commented 1 year ago

Yeah i can also reproduce in all browsers with NVDA 2023.2, but only when I trigger the dialog out of browse mode. This issue is not reproducible when triggering the dialog out of focus mode. I thought cancellable speech when focus event expires would help here but it didn't. This needs deeper investigation.