Skip to content

Commit

Permalink
Fix more cases of grand child window focus failures (#15455)
Browse files Browse the repository at this point in the history
Closes #15432

Summary of the issue:
Some events for grand child windows in applications seem to be ignored.

Description of user facing changes
Focus changes are reported in these cases.

Description of development approach
Generalize the workaround that was expanded for Edge in #15300
  • Loading branch information
LeonarddeR committed Sep 20, 2023
1 parent c2e2cdb commit 262b27c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
20 changes: 6 additions & 14 deletions source/eventHandler.py
Expand Up @@ -498,22 +498,14 @@ def shouldAcceptEvent(eventName, windowHandle=None):
return True

fg = winUser.getForegroundWindow()
fgClassName=winUser.getClassName(fg)
# #5504, #14916, #15432 : Some windows, such as in the Office ribbon or Edge downloads window
# aren't directly beneath the foreground window, so our foreground application checks fail.
# However, they share the same root owner and events for them should be allowed.
if (
# #5504: In Office >= 2013 with the ribbon showing only tabs,
# when a tab is expanded, the window we get from the focus object is incorrect.
# This window isn't beneath the foreground window.
wClass == "NetUIHWND" and fgClassName in ("Net UI Tool Window Layered", "Net UI Tool Window")
or (
# #14916: The context menu in the Edge download window isn't beneath the foreground window.
wClass == fgClassName
and wClass.startswith("Chrome_WidgetWin_") and fgClassName.startswith("Chrome_WidgetWin_")
)
winUser.getAncestor(windowHandle, winUser.GA_ROOTOWNER)
== winUser.getAncestor(fg, winUser.GA_ROOTOWNER)
):
# Our foreground application checks fail.
# Just compare the root owners.
if winUser.getAncestor(windowHandle, winUser.GA_ROOTOWNER) == winUser.getAncestor(fg, winUser.GA_ROOTOWNER):
return True
return True
if (winUser.isDescendantWindow(fg, windowHandle)
# #3899, #3905: Covers cases such as the Firefox Page Bookmarked window and OpenOffice/LibreOffice context menus.
or winUser.isDescendantWindow(fg, winUser.getAncestor(windowHandle, winUser.GA_ROOTOWNER))):
Expand Down
2 changes: 1 addition & 1 deletion user_docs/en/changes.t2t
Expand Up @@ -58,7 +58,6 @@ There's also been bug fixes for the Add-on Store, Microsoft Office, Microsoft Ed
- Some shortcut keys have been updated in the NVDA menu. (#15364)
-


== Bug Fixes ==
- Microsoft Office:
- Fixed crash in Microsoft Word when Document formatting options "report headings" and "report comments and notes" were not enabled. (#15019)
Expand All @@ -82,6 +81,7 @@ There's also been bug fixes for the Add-on Store, Microsoft Office, Microsoft Ed
-
- Fixed support for System List view (``SysListView32``) controls in Windows Forms applications. (#15283)
- NVDA once again announces calculation results in the Windows 32bit calculator on Server, LTSC and LTSB versions of Windows. (#15230)
- NVDA no longer ignores focus changes when a nested window (grand child window) gets focus. (#15432)
-

== Changes for Developers ==
Expand Down

0 comments on commit 262b27c

Please sign in to comment.