feat: mouseRelay capability (relay mouse back/forward buttons from iframes)#3078
Open
YuanboXue-Amber wants to merge 3 commits into
Open
feat: mouseRelay capability (relay mouse back/forward buttons from iframes)#3078YuanboXue-Amber wants to merge 3 commits into
YuanboXue-Amber wants to merge 3 commits into
Conversation
865f7eb to
9a673b9
Compare
There was a problem hiding this comment.
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
mouseRelaymodule withisSupported(),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.
9a673b9 to
32a6d01
Compare
…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>
32a6d01 to
7cf8fa4
Compare
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.Suggestion cannot be applied right now. Please check back later.
Implementation of the
mouseRelaycapability proposed in #3077.