Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New focus target is not always announced #12147

mfairchild365 opened this issue Mar 10, 2021 · 0 comments · Fixed by #12252

New focus target is not always announced #12147

mfairchild365 opened this issue Mar 10, 2021 · 0 comments · Fixed by #12252


Copy link

mfairchild365 commented Mar 10, 2021

When an element is focused via JS, screen readers will usually announce it. However, this isn't always the case with NVDA, especially when the new focus target replaces the triggering element. This is a fairly common pattern that is found on the web, especially within dynamic widgets or single page applications.

Steps to reproduce:

  1. Go to
  2. Activate the 'load' button in each example
  3. Each example will 'pass' if the new focus target is announced by NVDA
  4. Observe that most examples fail in NVDA 2020.4

Update: This bug is also present when focus is sent to an element that already exists in the DOM long before the trigging element is removed. This differs from my first example, where the target element is added to the DOM after the triggering element is removed. I tested this new scenario against JAWS, VO (macOS, and iOS), and NVDA. Only NVDA is silent. For example, see

Actual behavior:

Some examples fail and other pass. Details of what passed and failed can be found at the end of the codepen.

Expected behavior:

In all examples, I'd expect the new focus target to be announced. Some screen readers do this (such as VoiceOver), and others are inconsistent (such as NVDA).

System configuration

NVDA installed/portable/running from source:


NVDA version:


Windows version:

Windows 10 20H2

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

  • Chrome 89
  • FF 86

Other information about your system:

Other questions

Does the issue still occur after restarting your computer?


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

Yes, I tried older versions of NVDA with similar results.

If add-ons are disabled, is your problem still occurring?


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


mfairchild365 added a commit to mfairchild365/nvda that referenced this issue Mar 31, 2021
If the previous focus object was removed, we might hit a false positive for overlap detection when the focus target is adjacent to the focus trigger.

This tracks the previous focus target so that we can account for this scenario when detecting overlaps.
michaelDCurran pushed a commit that referenced this issue Apr 20, 2021
fixes #12147

The new focus target is not always announced when:
1. The triggering button is activated while in browse mode
2. The triggering button is removed
3. The focus target is adjacent to where the triggering button was
This is because of the overlapping logic for browse mode focus changes that is used to prevent duplicate announcements. That overlapping logic did not account for this scenario.
See the linked codepens in #12147 for more examples.
I can not specially point to an instance of this in the wild, as all of my use-cases are behind a firewall. However, I know that this behavior is not unusual in SPA-style web apps.

Description of how this pull request fixes the issue:
This PR fixes the issue by altering the overlapping detecting logic so that:
1. We look at the state of the previous focus object
2. If the state of the previous focus object is DEFUNCT (no longer available) and an overlap was detected, then continue as if there was not an overlap.
@nvaccessAuto nvaccessAuto modified the milestone: 2021.1 Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging a pull request may close this issue.

2 participants