Skip to content

fix(ui): chat widget videos can't go fullscreen and widget captions get clipped - #168143

Merged
steipete merged 2 commits into
mainfrom
steipete/fullscreen-state-loss-80b7bb
Oct 10, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/fullscreen-state-loss-80b7bb

Conversation

@steipete

@steipete steipete commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

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_widget widget (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: chat and dashboard widgets render through the cross-origin sandbox proxy and then an inner srcdoc frame. Neither iframe granted fullscreen, so the browser disabled it in both nested documents. Both layers now grant it; the inner opaque-origin frame needs fullscreen *, which was verified in Chromium. MCP App frames are unchanged because their outer frame still grants nothing.
  • Sizing: the in-frame size reporter measures the <body> box. A trailing <p>'s default margin-bottom: 8px collapsed through body into the root, so the document was 8px taller than the reported frame height. The wrapper now makes body a 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.
  • Saved widgets: persisted transcripts and pinned dashboards keep their approved bytes, following the precedent of the runtime scroll bridge from fix: video widgets trap scrolling and start without previews #163762. The trusted sandbox runtime adds a zero-specificity :where(body){display:flow-root} rule after the Canvas host's private message, so authored body display 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 through window.event.
  • Clipping: the 14px rounded clip on canvas HTML previews only showed where it cut widget content, because iframe and widget backgrounds are transparent. Canvas HTML previews no longer round-clip. Image and MCP App previews keep their styling.

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.

Before: clipped caption and disabled fullscreen
After: caption intact and fullscreen 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 asserts document.scrollingElement.scrollHeight - innerHeight <= 0 and document.fullscreenEnabled === true. On the original production code it fails with 8px overflow and fullscreen disabled for both documents; with this change it passes.
  • The same suite's nonce-protection fixture now records any host nonce visible to an authored head.prepend override or a document MutationObserver. 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.ts and src/gateway/board-sandbox.test.ts pass. oxfmt is clean. check:changed on Testbox was green apart from an unrelated deprecated-import failure at src/gateway/server-methods/agents.ts:69 that reproduces on the exact base.
  • The original visual capture checks permission availability; the additional trusted-activation proof below verifies actual fullscreen entry and the nondelegated MCP boundary. A physical OS/window-manager transition was not tested.

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 commit 33f4714ef95b47c82d251ebb5290aa43af0c7efe keeps 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 main bc8f693df3aee184c65626f7e9c9c58889c51a8b (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 gives fullscreenEnabled=false, while both fullscreen and fullscreen * give true. 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 824514ce67a3804868d8dbb1089140a31eb671b1 in Chromium 153.0.8010.12. A standalone proof uses the real source Control UI, installMockGateway, and the unmodified production createSandboxHostHttpServer. It renders a chat Canvas widget and a dashboard mcp-app-view, each containing the same synthetic video and button. The click handler calls video.requestFullscreen() immediately from the trusted click, records the promise result and document.fullscreenElement, and the harness also checks the top document. It does not override iframe permissions.

  • Canvas: the click is trusted with active user activation; requestFullscreen() resolves; the inner fullscreen element is the video; the top fullscreen element is the iframe. document.exitFullscreen() then succeeds and clears fullscreen.
  • MCP App: the click is trusted with active user activation; the same request rejects with TypeError: Disallowed by permissions policy. Both inner and top documents remain outside fullscreen. The real MCP outer iframe has no allow attribute, while the shared inner proxy frame has allow="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.

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.
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui docker Docker and sandbox tooling agents Agent runtime and tooling size: S labels Oct 10, 2026
@steipete
steipete marked this pull request as ready for review October 10, 2026 03:17
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 824514ce67a3804868d8dbb1089140a31eb671b1
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/sandbox-host.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/sandbox-widget-scroll-bridge.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@steipete

Copy link
Copy Markdown
Contributor Author

@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 824514ce67a3804868d8dbb1089140a31eb671b1 with the current evidence.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This 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.

  • Before: The document overflows its reported height by 8px, the caption corner is clipped, and fullscreen is disabled.
  • After: The body contains the trailing margin, the caption remains visible, and the browser reports fullscreen enabled.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, useful repair with inspected visual evidence and meaningful browser coverage, held at C by the unproven fullscreen authority boundary.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Widget videos have disabled fullscreen controls, while trailing captions can be clipped or leave a small internal scroll.
Reason: The repair has clear user value, stays within existing owners, and its direction is established by the maintainer-authored PR.

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
Reviewed head: 824514ce67a3804868d8dbb1089140a31eb671b1

Before merge

  • Add real behavior proof - Authority-chain proof required: inspected Chromium screenshots demonstrate repaired captions and an enabled fullscreen control, and the real UI/sandbox regression checks new and legacy documents plus nonce privacy; fullscreenEnabled does not demonstrate a successful user-activated fullscreen transition or rejection through the nondelegated MCP App consumer. Supply redacted browser output or a recording showing both outcomes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve security review attention item - No concrete sandbox escape was found, but the newly delegated fullscreen permission still needs final-effect boundary evidence.
  • Resolve merge risk - Before merge, demonstrate that the shared inner-frame fullscreen grant remains ineffective for MCP Apps whose outer frame does not delegate fullscreen.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied browser evidence does not exercise successful fullscreen entry from a Canvas widget or rejection of the same request from an MCP App.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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 options

Maintainer options:

  1. Verify the fullscreen boundary (recommended)
    Record a user-activated fullscreen request succeeding through the Canvas widget frames and being rejected through the MCP App frames that share the proxy.
  2. Defer fullscreen delegation
    Keep the sizing and clipping repair while withholding the fullscreen grants until their browser permission boundary is demonstrated.

Provenance checked

  • Widget body sizing changes intended behavior with a stated reason (1cacb12: The existing body rule belongs to the widget design-system baseline; current-main blame and supplied provenance identify its theme and base-style purpose.)
  • Saved-widget runtime bridge keeps the original intent (90b2e28: Runtime installation before stored scripts supports saved documents while keeping scroll authority private.)
  • Canvas preview corner clipping changes intended behavior with a stated reason (68ae235: The earlier preview styling created a cleaner full-width host; the PR explains why transparent Canvas content makes its retained rounded clipping harmful.)

Testing

Proof path: shipped entry point.

Security

Needs attention: No concrete sandbox escape was found, but the newly delegated fullscreen permission still needs final-effect boundary evidence.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 90b2e28 adds src/agents/sandbox-widget-scroll-bridge.ts:2 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 90b2e284597f; files: src/agents/sandbox-widget-scroll-bridge.ts)
  • Vyctor H. Brzezowski: Raw commit 68ae235 adds ui/src/styles/chat/tool-cards.css:882 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 68ae235318c0; files: ui/src/styles/chat/tool-cards.css)

PR surface

Source +25, Tests +97, Docs +1. Total +123 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 26 1 +25
Tests 2 100 3 +97
Docs 1 2 1 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 128 5 +123

Labels

Label changes:

  • add P2: The defects affect embedded video controls and widget readability without blocking the core conversation workflow.
  • add merge-risk: 🚨 security-boundary: The shared sandbox now delegates native fullscreen to opaque-origin content, requiring evidence that nondelegated consumers remain excluded.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: The defects affect embedded video controls and widget readability without blocking the core conversation workflow.
  • merge-risk: 🚨 security-boundary: The shared sandbox now delegates native fullscreen to opaque-origin content, requiring evidence that nondelegated consumers remain excluded.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Show user-activated fullscreen succeeding in a Canvas widget and being rejected in an MCP App through the real shared sandbox.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

Reviewed October 10, 2026, 12:07 AM ET / 04:07 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

@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.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 10985c0 into main Oct 10, 2026
219 of 228 checks passed
@steipete
steipete deleted the steipete/fullscreen-state-loss-80b7bb branch October 10, 2026 05:12
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docker Docker and sandbox tooling docs Improvements or additions to documentation merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant