Repository navigation
fix(ui): chat widget videos can't go fullscreen and widget captions get clipped - #168143
Conversation
Grant fullscreen through the chat and dashboard frames and explicitly to opaque-origin inner srcdoc frames. Missing nested grants disabled native video fullscreen controls. Contain child margins and floats in the widget body with display:flow-root. Collapsed trailing paragraph margins previously left documents 8px taller than their reported frame height. Add a low-specificity runtime rule only after the trusted Canvas host message so saved chat and dashboard documents retain their approved stored bytes and authored layouts. Consume private host state before authored DOM operations can throw. Remove inherited corner rounding only from Canvas HTML previews, where transparent backgrounds hid the clipping until captions reached a corner. Preserve image/MCP App preview styling and the loading skeleton's radius. Document the sizing and native fullscreen behavior. Extend the existing Chromium autosize suite with synthetic trailer and legacy saved-document coverage. Original production code fails at 8px overflow and disabled fullscreen; fixed documents fit with fullscreen available. Preserve wheel, nested-scroll, playback, and nonce protection.
The saved-document flow-root shim ran DOM methods inside the trusted host message handler. Authored code could replace those methods, or observe the inserted style with a MutationObserver whose microtask runs before window.event is restored, and read the scroll nonce from window.event. Capture the native primitives when the bridge installs and insert the style in a later task, after dispatch finishes. The autosize e2e now records any nonce visible to an authored prepend override or document observer.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
@clawsweeper re-review The PR now includes the exact-head passing widget tests and an independently reproduced inherited CI failure. Automatic exact-review attempts have repeatedly been cancelled before any job steps ran. Please review the unchanged head |
|
🦞👀 Re-review progress:
|
|
Codex review: needs real behavior proof before merge. What this changesThis PR enables native video fullscreen in Canvas widgets and fixes widget sizing and caption clipping. Example: A trailer widget ends with a paragraph whose bottom margin is 8px.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep open: this maintainer-authored PR addresses concrete widget defects still present on main, with no confirmed introduced correctness defect. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe Control UI loads Canvas HTML through a dedicated-origin sandbox proxy into an opaque-origin inner iframe; widget measurements return through the proxy to size the surrounding chat or dashboard frame. flowchart LR
A[Canvas document] --> B[Control UI widget view]
B --> C[Dedicated origin proxy]
C --> D[Opaque widget iframe]
D --> E[Size and scroll messages]
E --> B
D --> F[Browser fullscreen policy]
Technical reviewBest possible solution: Keep the focused sizing repair and browser-enforced fullscreen delegation limited to the intended Canvas frames. Do we have a high-confidence way to reproduce the issue? Current-main source lacks both nested fullscreen grants and body margin containment; the supplied before screenshot and reported baseline browser failure match those mechanisms. Is this the best way to solve the issue? The patch repairs the existing wrapper and sandbox owners, preserves authored display rules and saved bytes, and confines the clipping change to Canvas HTML previews. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fc7c5047e59a. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: shipped entry point. SecurityNeeds attention: No concrete sandbox escape was found, but the newly delegated fullscreen permission still needs final-effect boundary evidence. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +25, Tests +97, Docs +1. Total +123 across 9 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 10, 2026, 12:07 AM ET / 04:07 UTC. |
|
@clawsweeper re-review The new “Fullscreen authority-chain proof” section addresses the three proof/security attention items in the review. On unchanged head 824514c, trusted clicks through the real Canvas and MCP App components shared the unmodified production sandbox: Canvas entered actual video/ancestor fullscreen and exited successfully; MCP rejected with “Disallowed by permissions policy” and neither document entered fullscreen. The body includes the browser output, exact frame permissions, and proof command. No tracked source changes. |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…et clipped (openclaw#168143) * fix(ui): restore widget fullscreen and content-fit previews Grant fullscreen through the chat and dashboard frames and explicitly to opaque-origin inner srcdoc frames. Missing nested grants disabled native video fullscreen controls. Contain child margins and floats in the widget body with display:flow-root. Collapsed trailing paragraph margins previously left documents 8px taller than their reported frame height. Add a low-specificity runtime rule only after the trusted Canvas host message so saved chat and dashboard documents retain their approved stored bytes and authored layouts. Consume private host state before authored DOM operations can throw. Remove inherited corner rounding only from Canvas HTML previews, where transparent backgrounds hid the clipping until captions reached a corner. Preserve image/MCP App preview styling and the loading skeleton's radius. Document the sizing and native fullscreen behavior. Extend the existing Chromium autosize suite with synthetic trailer and legacy saved-document coverage. Original production code fails at 8px overflow and disabled fullscreen; fixed documents fit with fullscreen available. Preserve wheel, nested-scroll, playback, and nonce protection. * fix(ui): keep the widget host nonce private during the layout shim The saved-document flow-root shim ran DOM methods inside the trusted host message handler. Authored code could replace those methods, or observe the inserted style with a MutationObserver whose microtask runs before window.event is restored, and read the scroll nonce from window.event. Capture the native primitives when the bridge installs and insert the style in a later task, after dispatch finishes. The autosize e2e now records any nonce visible to an authored prepend override or document observer.
What Problem This Solves
Fixes: inline chat widgets with video cannot go fullscreen, and content-fitted widgets scroll by a few pixels with their last line clipped by the rounded preview corner.
User Impact
User impact: video in a
show_widgetwidget (chat and pinned dashboards) can enter fullscreen from its native controls, widgets fit their content exactly without an internal scroll, and captions or text at the widget's bottom-left corner are no longer cut off. Already-saved widgets get the same sizing fix without rewriting their stored HTML.Why This Change Was Made
fullscreen, so the browser disabled it in both nested documents. Both layers now grant it; the inner opaque-origin frame needsfullscreen *, which was verified in Chromium. MCP App frames are unchanged because their outer frame still grants nothing.<body>box. A trailing<p>'s defaultmargin-bottom: 8pxcollapsed throughbodyinto the root, so the document was 8px taller than the reported frame height. The wrapper now makesbodya block formatting context (display:flow-root), so the body box contains child margins and floats. This also fixes image-export sizing, which uses the same measurement.:where(body){display:flow-root}rule after the Canvas host's private message, so authoredbodydisplay rules still win and MCP Apps and HTML previews never change. The insert uses captured native DOM primitives in a later task, so authored code can never observe the host nonce throughwindow.event.Evidence
Before and after: synthetic trailer widget, mock gateway, Chromium, dark theme. Before: the caption's "P" is clipped at the bottom-left and the fullscreen button is disabled. After: the caption is intact and fullscreen is available.
ui/src/e2e/chat-widget-autosize.e2e.test.ts(pnpm test <file> --maxWorkers=1, ~23 s wall time, two browser tests): it covers a trailer-shaped widget plus a legacy saved document built with the pre-fix shell. Inside the inner widget document it assertsdocument.scrollingElement.scrollHeight - innerHeight <= 0anddocument.fullscreenEnabled === true. On the original production code it fails with 8px overflow and fullscreen disabled for both documents; with this change it passes.head.prependoverride or a documentMutationObserver. It fails on the first version of the shim, which mutated the DOM inside the message handler, and passes with the deferred, captured-primitive insert.src/canvas/wrap.test.tsandsrc/gateway/board-sandbox.test.tspass. oxfmt is clean.check:changedon Testbox was green apart from an unrelated deprecated-import failure atsrc/gateway/server-methods/agents.ts:69that reproduces on the exact base.Related: a separate PR keeps a playing inline widget alive when its run finishes or the gateway client reconnects.
Current PR CI and review disposition
CI run 38020067087, attempt 1, tested head
824514ce67a3804868d8dbb1089140a31eb671b1. The widget regression and nested-scroll sibling passed in UI E2E shard 2/9 (45 files, 214 tests); UI unit shard 1/3 passed 532 files and 7,410 tests.The sole root failure is unrelated:
session-management.mutation-scope.e2e.test.ts, “keeps All rows, pagination, and updates after another agent's rename settles,” times out at line 170 because the Rename session modal intercepts the sidebar click. Main commit33f4714ef95b47c82d251ebb5290aa43af0c7efekeeps that modal open while the rename request is pending; the test deliberately defers that request until after its blocked click. The same failure reproduced on unchanged mainbc8f693df3aee184c65626f7e9c9c58889c51a8b(1 failed, 3 passed; 61.43 seconds). This fixture contains no widget documents or canvas previews, and its test/rename/modal inputs are unchanged by this PR. The CI aggregate failed and three sibling jobs were cancelled by the fail-fast monitor; those cancellations are not passing coverage. Landing uses the native inherited-failure exception with retained exact-head and baseline evidence, without rerunning CI or changing source.A local review concern about the legacy dashboard iframe's bare
allow="fullscreen"was rejected using the exact sandboxed cross-origin frame shape in Chromium 153: with an opaque origin, no grant givesfullscreenEnabled=false, while bothfullscreenandfullscreen *givetrue. The nested proxy retains the explicit wildcard grant. No accepted/actionable local review findings remain.Fullscreen authority-chain proof (ClawSweeper follow-up)
Passed on unchanged head
824514ce67a3804868d8dbb1089140a31eb671b1in Chromium153.0.8010.12. A standalone proof uses the real source Control UI,installMockGateway, and the unmodified productioncreateSandboxHostHttpServer. It renders a chat Canvas widget and a dashboardmcp-app-view, each containing the same synthetic video and button. The click handler callsvideo.requestFullscreen()immediately from the trusted click, records the promise result anddocument.fullscreenElement, and the harness also checks the top document. It does not override iframe permissions.requestFullscreen()resolves; the inner fullscreen element is the video; the top fullscreen element is the iframe.document.exitFullscreen()then succeeds and clears fullscreen.TypeError: Disallowed by permissions policy. Both inner and top documents remain outside fullscreen. The real MCP outer iframe has noallowattribute, while the shared inner proxy frame hasallow="fullscreen *".The assertions inspect the final browser effect, not just
fullscreenEnabled. This addresses the requested successful Canvas transition and rejected MCP transition through the shared production sandbox. Headless browser proof; no claim about a physical OS/window-manager animation.{ "head": "824514ce67a3804868d8dbb1089140a31eb671b1", "browser": "153.0.8010.12", "canvas": {"trusted": true, "active": true, "resolved": true, "fullscreenVideo": true, "outerAllow": "fullscreen", "innerAllow": "fullscreen *", "top": {"fullscreen": true, "tag": "IFRAME"}}, "mcp": {"trusted": true, "active": true, "resolved": false, "errorName": "TypeError", "errorMessage": "Disallowed by permissions policy", "fullscreenVideo": false, "outerAllow": null, "innerAllow": "fullscreen *", "top": {"fullscreen": false, "tag": null}}, "result": "passed" }Proof command:
node --import ./scripts/tsx.mjs .local/fullscreen-land/fullscreen-proof/activation-proof.mts. The temporary proof script and JSON are not committed. Nonfatal ResizeObserver-loop warnings occurred during the transition; all assertions passed. No production source or tests changed after the reviewed head.