nvda sometime speaks too much when switching windows in a multi-window java app #5732

Closed
rpaquay opened this Issue Feb 3, 2016 · 1 comment

Projects

None yet

3 participants

@rpaquay
rpaquay commented Feb 3, 2016

This is somewhat difficult to reproduce, but nvda sometimes speaks too much, i.e. speaks the window title + all the context leading to the focused element inside the window, even though it should not speak the window title at all.

This happens in particular with IntelliJ/Android Studio when bringing up the Code Completion list in an editor text window, then closing the Code Completion list after moving the arrow up/down.

A PR is coming with a fix.

@rpaquay rpaquay added a commit to rpaquay/nvda that referenced this issue Feb 3, 2016
@rpaquay rpaquay Remove incorrect vmIDsToWindowHandles cache
The vmIDsToWindowHandles cache is base on an incorrect assumption
that there is a mapping between a jvmid to a _single_ Window Handle.
This is incorrect as a Java application can have many top level
windows (each top level frame corresponds to a unique Window Handle).

The cache was introduced in 2007:

nvaccess@d4a74c7
c5d667e83b

This code was incorrect at the time, but was good enough to make things
work with Java applications that have only one top level frame.

A commit in 2010 implemented the correct way of retrieving the window
handle from a given AccessibleContext:

nvaccess@eddfb4b
4bc12582e5

This effectively removed the need of using cache, but the cache was
not removed for some reason.

The symptom of the issue is described in bug #5732.
ef649e6
@jcsteh jcsteh added this to the 2016.2 milestone Feb 4, 2016
@jcsteh jcsteh added a commit that referenced this issue Feb 22, 2016
@rpaquay @jcsteh rpaquay + jcsteh NVDA no longer reports extraneous information when switching windows …
…in a Java application with multiple windows such as IntelliJ and Android Studio.

Previously, NVDA incorrectly assumed a vmid mapped to a single hwnd. However, a Java application can have many top level frames, each mapping to its own hwnd.
To fix this:
* Use getTopLevelObject and getHWNDFromAccessibleContext to retrieve the hwnd of a given vmid/accessible context.
* Fallback to using a "last known" hwnd cache when the above fails.
* Keep track of the hwnd when firing event_gainFocus and event_caret so that we don't need to retrieve the hwnd using both methods above when processing those events.
* Use jab context only for equality, ignore window handles. Given comparing accessible context for equality does not require valid windows handles, and given that retrieving window handles for accessible context is not 100% reliable, we implement the JAB(Window)._isEqual method to be similar to UIA(Window): Compare the accessible components, and ignore the window handles.

Fixes #5732. Closes #5733 (PR).
1b7ff71
@nvaccessAuto

Incubated in 9432f7f.

@jcsteh jcsteh was assigned by nvaccessAuto Feb 22, 2016
@nvaccessAuto nvaccessAuto removed the incubating label Mar 8, 2016
@jcsteh jcsteh added a commit that closed this issue Mar 8, 2016
@rpaquay @jcsteh rpaquay + jcsteh NVDA no longer reports extraneous information when switching windows …
…in a Java application with multiple windows such as IntelliJ or Android Studio.

Previously, NVDA incorrectly assumed a vmid mapped to a single hwnd. However, a Java application can have many top level frames, each mapping to its own hwnd.
To fix this:
* Use getTopLevelObject and getHWNDFromAccessibleContext to retrieve the hwnd of a given vmid/accessible context.
* Fallback to using a "last known" hwnd cache when the above fails.
* Keep track of the hwnd when firing event_gainFocus and event_caret so that we don't need to retrieve the hwnd using both methods above when processing those events.
* Use jab context only for equality, ignore window handles. Given comparing accessible context for equality does not require valid windows handles, and given that retrieving window handles for accessible context is not 100% reliable, we implement the JAB(Window)._isEqual method to be similar to UIA(Window): Compare the accessible components, and ignore the window handles.

Fixes #5732. Closes #5733 (PR).
284e670
@jcsteh jcsteh closed this in 284e670 Mar 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment