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 摘要。