Skip to content

feat: mouseRelay capability (relay mouse back/forward buttons from iframes)#3078

Open
YuanboXue-Amber wants to merge 3 commits into
OfficeDev:mainfrom
YuanboXue-Amber:users/yuanboxue/mouse-relay-capability
Open

feat: mouseRelay capability (relay mouse back/forward buttons from iframes)#3078
YuanboXue-Amber wants to merge 3 commits into
OfficeDev:mainfrom
YuanboXue-Amber:users/yuanboxue/mouse-relay-capability

Conversation

@YuanboXue-Amber

@YuanboXue-Amber YuanboXue-Amber commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Implementation of the mouseRelay capability proposed in #3077.

@YuanboXue-Amber YuanboXue-Amber force-pushed the users/yuanboxue/mouse-relay-capability branch 2 times, most recently from 865f7eb to 9a673b9 Compare June 30, 2026 08:45
@YuanboXue-Amber YuanboXue-Amber marked this pull request as ready for review June 30, 2026 08:45
@YuanboXue-Amber YuanboXue-Amber requested a review from a team as a code owner June 30, 2026 08:45
Copilot AI review requested due to automatic review settings June 30, 2026 08:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Introduces a new public TeamsJS capability, mouseRelay, enabling apps inside a Teams iframe to forward mouse back/forward (X1/X2) button intent to the host so the host can drive Teams history navigation (primarily for desktop/WebView2 parity with web behavior described in #3077).

Changes:

  • Adds new public mouseRelay module with isSupported(), enableMouseRelayCapability(), and a reset helper, plus host-call telemetry wiring.
  • Extends runtime capability typing to include supports.mouseRelay.
  • Adds unit tests and a Teams test app surface for exercising the new capability.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/teams-js/test/public/mouseRelay.spec.ts Adds unit tests covering support checks, forwarding on mouseup, suppression on mousedown, and reset behavior.
packages/teams-js/src/public/runtime.ts Extends runtime capability typing to include supports.mouseRelay.
packages/teams-js/src/public/mouseRelay.ts Implements the new capability: capture-phase listeners to suppress X1/X2 native nav and forward intent to host on mouseup.
packages/teams-js/src/public/index.ts Exports the new mouseRelay module from the public API surface.
packages/teams-js/src/internal/telemetry.ts Adds ApiName.MouseRelay_ForwardNavigation for host messaging/telemetry tagging.
change/@microsoft-teams-js-e7c0b12b-b04f-4889-8666-0308f962df9d.json Adds a changefile entry describing the new capability.
apps/teams-test-app/src/pages/TestApp.tsx Registers the new MouseRelay test component in the test app navigation.
apps/teams-test-app/src/components/MouseRelayAPIs.tsx Adds a test app UI for checking support, enabling, and resetting mouse relay.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/teams-test-app/src/components/MouseRelayAPIs.tsx
Comment thread packages/teams-js/test/public/mouseRelay.spec.ts
@YuanboXue-Amber YuanboXue-Amber force-pushed the users/yuanboxue/mouse-relay-capability branch from 9a673b9 to 32a6d01 Compare June 30, 2026 09:26
@YuanboXue-Amber YuanboXue-Amber changed the title feat: mouseRelay capability (forward mouse back/forward buttons from iframes) feat: mouseRelay capability (relay mouse back/forward buttons from iframes) Jun 30, 2026
…rom iframes)

Add a new `mouseRelay` capability, the mouse analog of `shortcutRelay`. An app
inside a Teams iframe can forward the mouse back (X1) / forward (X2) buttons to
the host so they drive Teams history navigation when focus is inside the iframe.

- Captures X1/X2 (MouseEvent.button 3/4) with capture-phase listeners and
  forwards a semantic { direction: 'back' | 'forward' } via
  ApiName.MouseRelay_ForwardNavigation.
- Forwards on `mouseup` to match the browser's native release timing; suppresses
  the iframe's own native nav on `mousedown`/`auxclick`.
- Gated by runtime.supports.mouseRelay; hosts advertise it on desktop only (on
  web the browser already handles X1/X2 over the joint session history).
- Exposes isSupported(), enableMouseRelayCapability(),
  resetIsMouseRelayCapabilityEnabled().

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 30, 2026 09:57
@YuanboXue-Amber YuanboXue-Amber force-pushed the users/yuanboxue/mouse-relay-capability branch from 32a6d01 to 7cf8fa4 Compare June 30, 2026 09:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

…nit test

- MouseRelayAPIs: remove the synthetic back-button mouseup and relabel the action so testers press the physical X1/X2 button (Copilot review)
- mouseRelay.spec: add a focused auxclick test asserting the synthetic click is suppressed and no navigation is forwarded
Copilot AI review requested due to automatic review settings July 1, 2026 11:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread packages/teams-js/src/public/mouseRelay.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants