No longer access MS Office ribbons, status bars and context menus via UIA for Office <= 2013#10981
Conversation
… IAccessible for Office 2013 and earlier.
|
@dkager would you be able to test with 2013? |
|
I've finally been able to got hold of the machine with 2013 remotely,, and can confirm that these fixes works there. I've updated the description accordingly. @michaelDCurran @feerrenrut I believe this would benefit from longer cycle of being in master - I've tested it of course but with changes like these there are often some edge cases. |
| # FIX ME! | ||
| # Quick testing shows that prorer focus event are emitted yet they are ignored by NVDA. | ||
| if( | ||
| appModule.productName.startswith("Microsoft Office") |
There was a problem hiding this comment.
why isn't this code in the appmodule as per appModule.isBadUIAWindow above?
Also note, earlier lines indicate that appModule may be None
There was a problem hiding this comment.
Because all Office applications share the common product name but does not share single executable. Doing this at the appModule level would require separate module for at least:
- Word
- Excel
- Outlook
- Powerpoint
- Visio
- Project
- Access
and there is no "guarantee that all Office apps are covered whereas using product name is safe.
| # and not being able to report ribbon sections when they starts with an edit field (#7067) | ||
| # The last problem also exiists for Office 2016, however using IAccessible for collabsed ribbons | ||
| # causes NVDA not to report focus changes. | ||
| # FIX ME! |
There was a problem hiding this comment.
Please don't leave 'Fix me' in. Please clarify this comment to specify the things fixed, and the remaining problems. Remaining problems should should have an issue number for more in depth discussion.
You can clarify this by:
- Avoid writting "this". Above, 'this class' is ambiguous, I assume it relates to the window class?
- Start lines with 'fixes:' or 'remaining issue:'
'NetUIHWND is used for some controls in MS office.
IAccessible should be used in place of UIA for NetUIHWND classes in office versions before 2016:
- Fixes: 'lack of focus reporting (#4207)'
- Fixes: 'strange reporting of context menu items (#9252)'
- Fixes: 'not being able to report ribbon sections when they start with an edit field (#7067)'
- Remaining issue #XYZ: In office 2016, similar to #7067, ribbon sections that start with an edit fields are not reported. When using IAccessible for collapsed ribbons stops focus changes being reported. Testing shows that focus events are emitted but ignored.
See test results for failed build of commit 7cfc6ccda0 |
|
@feerrenrut I've hopefully clarified the commends and addressed your other concerns. This is ready for another look. |
| if windowClass == "NetUIHWND": | ||
| # NetUIHWND is used for various controls in MS Office. | ||
| # IAccessible should be used for NetUIHWND in versions older than 2016 | ||
| # Fixes: lack of focus reporting (#4207), | ||
| # Fixes: strange reporting of context menu items(#9252), | ||
| # fixes: not being able to report ribbon sections when they starts with an edit field (#7067) | ||
| # Note that #7067 is not fixed for Office 2016 and never. | ||
| # Using IAccessible for NetUIHWND controls causes focus changes not to be reported | ||
| # when the ribbon is collapsed. | ||
| # Testing shows that these controls emits proper events but they are ignored by NVDA. | ||
| if( | ||
| appModule.productName.startswith(("Microsoft Office", "Microsoft Outlook")) | ||
| and int(appModule.productVersion.split(".")[0]) < 16 | ||
| ): | ||
| parentHwnd = winUser.getAncestor(hwnd, winUser.GA_PARENT) | ||
| while parentHwnd: | ||
| if winUser.getClassName(parentHwnd) in ("Net UI Tool Window", "MsoCommandBar",): | ||
| return False | ||
| parentHwnd = winUser.getAncestor(parentHwnd, winUser.GA_PARENT) |
There was a problem hiding this comment.
App module might be None. The following suggestion makes this check when matching the window class name, and names the checks for isOfficeApp and isBefore2016Version
if windowClass == "NetUIHWND" and appModule:
# NetUIHWND is used for various controls in MS Office.
# IAccessible should be used for NetUIHWND in versions older than 2016
# Fixes: lack of focus reporting (#4207),
# Fixes: strange reporting of context menu items(#9252),
# fixes: not being able to report ribbon sections when they starts with an edit field (#7067)
# Note that #7067 is not fixed for Office 2016 and newer.
# Using IAccessible for NetUIHWND controls causes focus changes not to be reported
# when the ribbon is collapsed.
# Testing shows that these controls emits proper events but they are ignored by NVDA.
isOfficeApp = appModule.productName.startswith(("Microsoft Office", "Microsoft Outlook"))
isBefore2016Version = int(appModule.productVersion.split(".")[0]) < 16
if isOfficeApp and isBefore2016Version:
parentHwnd = winUser.getAncestor(hwnd, winUser.GA_PARENT)
while parentHwnd:
if winUser.getClassName(parentHwnd) in ("Net UI Tool Window", "MsoCommandBar",):
return False
parentHwnd = winUser.getAncestor(parentHwnd, winUser.GA_PARENT)|
@feerrenrut Done. |
Link to issue number:
Fixes #9252
Fixes #4207
Improves #7067
Summary of the issue:
Accessing MS Office ribbons via UIA especially for Older versions of Office has certain disadvantages:
Description of how this pull request fixes the issue:
IAccessible is used for these controls for Office <=2013. To do that it has been necessary to workaround some IAccessible specific issues:
In both cases AccValue contains non localized description of the control which made it possible to workaround them.
Testing performed:
In Office 365, Office 2010 and Office 2013:
Additionally for Office 2010 and 2013:
Known issues with pull request:
Change log entry:
Section: Bug fixes