Mini App pop-out window stays opaque under the webview renderer backend

未關閉
#597 10 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
typescript
領域
desktop

研究方向

Start with embedded-browser-manager.js and webview-host/host.js, then trace how the detached guest surface is created for the webview backend. Check the platform-specific APIs for setting a transparent guest background and compare behavior with the native web-contents-view backend. Done means a transparent Mini App pop-out reveals the desktop behind its transparent pixels on the webview backend, or the backend clearly communicates that it cannot honor the setting.

由索引模型根據 Issue 內容生成。

描述

What happens

A Mini App that declares a transparent pop-out window renders as an opaque black rectangle when the client uses the webview renderer backend. The same package, unchanged, is fully transparent on the native web-contents-view backend.

Environment

  • MiniMax Code 3.1.12.216
  • Windows 11, build 26300 (UBR 9818)
  • Package installed under %USERPROFILE%\.minimax\plugins\<plugin>
  • miniapp.json:
"surface": {
  "path": "/bottle",
  "window": {
    "width": 220,
    "height": 300,
    "minWidth": 220,
    "minHeight": 300,
    "resizable": false,
    "frame": false,
    "transparent": true,
    "alwaysOnTop": true,
    "skipTaskbar": false
  }
}

Steps

  1. Install the package, open it in the side panel, pop it out into its own window.
  2. The window is a black rectangle around the page content, and it takes the mouse over its whole area.
  3. The client log confirms the backend:
[EmbeddedBrowserLifecycle] shown {"rendererBackend":"webview","requestedRendererBackend":"webview",
  "backendPolicyRevision":1,"event":"shown", ... "presentation":"detached"}

The page is not painting the backdrop

  • In window mode the page forces html, body and the app root to background: transparent !important, and the stage, panels and footer are display: none.
  • A headless Chromium render of the same page at 220×300 has alpha = 0 at all four corners, so the document paints nothing.
  • With the native backend the identical package is transparent, so the difference is the guest surface, not the document.

Where it looks broken

embedded-browser-manager.js passes the declaration through when it rebuilds the guest for a detach:

transparentBackground: host === tab.detachedWindow && tab.miniApp?.window?.transparent === true,

and webview-host/host.js only applies it as CSS on the host element:

Object.assign(entry.page.style, {
  colorScheme: "light",
  backgroundColor: descriptor.transparentBackground ? "transparent" : "Canvas"
});

The guest's own surface keeps an opaque background, so a transparent CSS background on the <webview> element cannot reveal what is behind the window.

Expected

A window declared "transparent": true should show the desktop behind the page's transparent pixels, as it does with web-contents-view.

Suggested fix

  • Give the guest a transparent background where the platform supports one (a transparent webContents background / WebView2 default background), instead of relying on CSS on the host element; or
  • Keep transparent: true Mini Apps on the native backend and state that the webview backend cannot honour the flag, so packages can avoid the declaration there.

Related

-webkit-app-region: drag is inert inside the webview guest as well, so a popped-out page has to move its own window through window.mcode.miniapp.window.update({ x, y }). That works, but docs/client.md recommends the app-region, and a page that follows the documentation ends up with a window the user cannot move at all.

主要語言
TypeScript
星號
2.3k
分支
315
平均合併
3 小時 54 分鐘
30 天內合併 PR
9

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

MiniMax-AI/minimax-code 的其他 Issue

查看 MiniMax-AI/minimax-code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。