fix(apps): declare color-scheme to allow transparent MCP App iframes#7479
Merged
fix(apps): declare color-scheme to allow transparent MCP App iframes#7479
Conversation
Goose toggles dark mode via a CSS class but never declared color-scheme on the document. When an MCP App iframe declares color-scheme: light dark, the browser detects a cross-scheme mismatch and paints an opaque backdrop behind the iframe (white in light mode, black in dark mode), making it impossible for apps to be transparent. Three changes at each layer of the iframe stack: 1. Sandbox proxy HTML — add <meta name="color-scheme" content="light dark"> so the transparent relay document doesn't trigger an opaque backdrop regardless of the parent's or child's color scheme. 2. ThemeContext.tsx — set document.documentElement.style.colorScheme to match the resolved theme at runtime, preventing cross-scheme mismatch between Goose and the proxy iframe. 3. index.html — same colorScheme assignment in the early inline theme script so it's correct before React mounts. Fixes #7439
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes iframe transparency issues for MCP Apps by declaring color-scheme CSS property across all layers of the iframe stack (Goose document → sandbox proxy iframe → guest app iframe). When MCP Apps declare color-scheme: light dark and rely on transparency, they were getting an opaque backdrop due to cross-scheme mismatch between parent and child documents. The fix ensures proper color-scheme alignment at all iframe boundaries.
Changes:
- Added
color-schememeta tag tomcp_app_proxy.htmlsandbox proxy to declare support for both light and dark schemes - Updated
ThemeContext.tsxto setdocument.documentElement.style.colorSchemedynamically based on resolved theme - Updated
index.htmlearly theme initialization script to setcolorSchemebefore React mounts
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
crates/goose-server/src/routes/templates/mcp_app_proxy.html |
Added color-scheme: light dark meta tag to sandbox proxy document |
ui/desktop/src/contexts/ThemeContext.tsx |
Set colorScheme style property in applyThemeToDocument function |
ui/desktop/index.html |
Set colorScheme in early inline theme initialization script for dark mode paths |
Address Copilot review feedback — the no-localStorage and catch fallback paths only set colorScheme when dark, leaving it undefined in light mode which can still cause opaque iframe backdrops.
zanesq
added a commit
that referenced
this pull request
Feb 25, 2026
…m-cache * 'main' of github.com:block/goose: chore(release): release version 1.25.0 (minor) (#7263) Docs: Community all-stars and page update (#7483) fix: searchbar zindex modal overlay (#7502) blog: Order Lunch Without Leaving Your AI Agent (#7505) feat: gateway to chat to goose - telegram etc (#7199) Option to add changeable defaults in goose-releases (#7373) Fix out of order messages (#7472) fix: ensure latest session always displays in sidebar (#7489) docs: rename TLDR to Quick Install in MCP tutorials (#7493) docs: update Neighborhood extension page with video embed and layout improvements (#7473) feat: let AskAI Discord bot see channels in the server (#7480) Apps token limit (#7474) fix(apps): declare color-scheme to allow transparent MCP App iframes (#7479)
u35tpus
pushed a commit
to u35tpus/goose
that referenced
this pull request
Feb 26, 2026
…lock#7479) Signed-off-by: Oleg Levchenko <[email protected]>
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.
Summary
Fixes #7439
MCP App iframes that declare
color-scheme: light darkand rely on transparency get an opaque backdrop (white in light mode, black in dark mode) because Goose never declaredcolor-schemeon its own document or the sandbox proxy iframe.Root Cause
Goose toggles dark mode via a
.darkCSS class but never sets thecolor-schemeCSS property. When a guest app iframe declarescolor-scheme: light dark, the browser detects a cross-scheme mismatch between the parent document and the iframe, and per the CSS Color Adjustment spec paints an opaque canvas behind the iframe.The iframe stack is: Goose document → sandbox proxy iframe → guest app iframe. Each boundary is a potential cross-scheme mismatch point.
Changes
Three changes, one at each layer of the iframe stack:
mcp_app_proxy.html— Add<meta name="color-scheme" content="light dark">to the sandbox proxy. This is the key fix — the proxy is a transparent relay document with no visible content, so declaring both schemes tells the browser not to paint an opaque backdrop.ThemeContext.tsx— Setdocument.documentElement.style.colorSchemeto match the resolved theme at runtime, preventing cross-scheme mismatch at the Goose↔proxy boundary.index.html— SamecolorSchemeassignment in the early inline theme script so it's correct before React mounts.goose theme: system
goose theme: light
goose theme: dark
goose theme: system
goose theme: light
goose theme: dark
Why
colorScheme = themeinstead ofcolor-scheme: light darkSetting
color-scheme: light darkglobally on the Goose document would tell the browser to auto-apply dark UA styles (scrollbars, form controls, default backgrounds) based on OS preference — potentially conflicting with Goose's own theme token system. By setting exactlylightordarkto match the resolved theme, we stay in full control.Testing