Skip to content

Support interacting with Microsoft Loop Components in Microsoft Office products#13617

Merged
michaelDCurran merged 3 commits into
masterfrom
loopComponents
Apr 20, 2022
Merged

Support interacting with Microsoft Loop Components in Microsoft Office products#13617
michaelDCurran merged 3 commits into
masterfrom
loopComponents

Conversation

@michaelDCurran

Copy link
Copy Markdown
Member

Link to issue number:

None.

Summary of the issue:

Last year Microsoft announced Microsoft Loop – a new app which combines canvas with portable components that stay in sync and move freely across Microsoft 365 apps. Microsoft Loop: Flexible Canvas App | Microsoft 365. In short, these loop components can be added in emails, teams chats etc. These loop components use WebView2 controls is in visual hosting mode.

When focusing one of these loop components, NVDA stays silent, does not track the focus, and provides no means of interacting with the embedded document.

Steps to reproduce in Microsoft Powerpoint:

  1. Launch PowerPoint
  2. Launch NVDA
  3. In PowerPoint, use keyboard shortcuts to navigate to Insert Tab (Alt N)
  4. Insert either a PowerBI (PO) or Forms (F) add-in
  5. Use NVDA to interact with the inserted components. I.e. tab through the content of the slide -- focus will also move through the inserted form.

NVDA is ignoring events (including focus change events) in this embedded webview2 (Chromium) document as according to Windows the embedded document is never in the foreground, I.e. is not a descendant or, or owned by, the foreground window.

When focus moves inside the Loop component, There is a Chrome_WidgetWin_0 window which gets focus, and this is correctly a descendant of the webview2 control window and in tern the _WwG document in Outlook and therefore a descendant of the foreground window. NVDA does see this at least. But, this Chrome_WidgetWin_0 window has no real content at all.

The actual document content we are interested in is in its own Chrome_RenderWidgetHostHWND window, whose parent window is a Chrome_WidgetWin_1 top-level window. This top-level window is of course not a descendant of the foreground window, nor is it owned by the foreground or a descendant. Thus when NVDA sees events for controls inside this window, they get dropped as they seem to be in the background and not relevant to the user.

Although Microsoft is unwilling to address the underlying issue by ensuring the Chromium document window is either owned by or a descendant of the foreground window, they have at least ensured that the ancestors of the Chromium document in the UIA tree does lead back to the embedding window in the Office document. Thus we can use UIA to detect this and allow the event through.

Description of how this pull request fixes the issue:

eventHandler.shouldAcceptEvent detects this specific scenario and allows the event through.
Specifically:
If the event's window is a background Chrome_RenderWidgetHostHWND, and the win32 focus is on a Chrome_WidgetWin_0 window, and the ancestor chain of the event window's UIA element leads back to a UIA element with a windowHandle matching the Chrome_WidgetWin_0 focused window, then the event is allowed through.

Testing strategy:

Ran the above steps to reproduce. Ensured that NVDA announced the embedded document and the arrow keys could be used to navigate the content in browse mode.

Known issues with pull request:

None known.

Change log entries:

New features

  • Support for interacting with Microsoft Loop Components in Microsoft Office products.
    Changes
    Bug fixes
    For Developers

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English

@michaelDCurran michaelDCurran requested a review from a team as a code owner April 19, 2022 02:06
@michaelDCurran michaelDCurran requested a review from seanbudd April 19, 2022 02:06
@michaelDCurran michaelDCurran changed the title Support focusing Microsoft Loop Components in Office products Support interacting with Microsoft Loop Components in Microsoft Office products Apr 19, 2022
@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Apr 19, 2022

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread source/eventHandler.py
@michaelDCurran michaelDCurran merged commit 6ec5ca3 into master Apr 20, 2022
@michaelDCurran michaelDCurran deleted the loopComponents branch April 20, 2022 07:07
@nvaccessAuto nvaccessAuto added this to the 2022.2 milestone Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants