Ignore redundant winEvents proxied from UIA on EXCEL7 windows #11818
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Link to issue number:
None
Summary of the issue:
when the selection / focus moves between cells on an Excel sheet (EXCEL7 window), Excel's UI Automation implementation fires appropriate selection / focus events. Although there is separate work to support Excel in NvDA via UI automation, at the moment Excel is supported via its object model and MSAA. But, as Excel fires these UI Automation events, Windows proxies them to MSAA winEvents. Not only do we have no use for them as we handle selection / focus tracking in Excel cells entirely with the keyboard, these winEvents are broken in that trying to fetch an IAccessible object from them always fails, but more importantly, fetching, and checking if the winEvent should be dropped as it in deed did come from UIA causes a freeze of several seconds on some machines.
I am unable to reproduce the freeze myself, but can at least see the redundant events.
The user who reported this via email was running Windows 10.0.17763 and Office 365 MSO (16.0.11929.20966) 32-bit.
Description of how this pull request fixes the issue:
Simply ignore all winEvents from EXCEL7 windows with an objectID greater than 0 as these are all proxied from UI Automation and we do not expect or need them.
We actually only expect a focus winEvent when the sheet gets focus, and anything else is not expected as historically Excel never fired any more winEvents than that. Thus all the winEvents now coming from its UI Automation implementation are redundant and cause a performance hit.
Testing performed:
Tested Excel locally by moving selection / focus between cells with the arrow keys and made sure that NVDA still reported the cells.
Provided multiple try builds to the user to test, and they reported that the freezes disappeared for them.
Known issues with pull request:
None.
Change log entry:
Bug fixes: