Skip to content

Show drawn visuals as an SVG image, not a sandboxed iframe - #93

Merged
a-Fig merged 1 commit into
mainfrom
visual-img
Nov 13, 2026
Merged

a-Fig merged 1 commit into
mainfrom
visual-img

Conversation

@a-Fig

@a-Fig a-Fig commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Closes #92

Why

In a real Google Meet call, show_visual charts showed their title over a blank white sheet. The same chart renders fine locally. The drawing lived in a sandboxed <iframe srcdoc>, which Recall's cloud capture browser evidently doesn't paint. Images do paint there.

Change

  • public/views/visual.js: both kinds of visual now render as an <img src="data:image/svg+xml,…">. An SVG drawing goes in as itself. An HTML block goes inside a <foreignObject> (1136×470, the frame's canvas). The markup is parsed as HTML and serialized as XML through XMLSerializer, because an SVG image must be well-formed and the model's markup needn't be. The token CSS (palette classes, display, the HTML layout that used to sit on body.html) goes into the SVG's own <style>. The iframe, its srcdoc and its CSP are gone.
  • Safety is unchanged in kind: an SVG loaded as an image can't run scripts or load anything, and the sanitizer still runs first. Model-written <foreignObject> is still stripped by the sanitizer; only the page's own wrapper uses it.
  • Cost: an image can't fetch the brand's web fonts, so the drawing's text uses Segoe UI / Helvetica / Arial / sans-serif fallbacks, which replace the serif default. The title above the drawing is page text and keeps the brand face.
  • visual.css swaps the iframe rule for an img rule (object-fit: contain). The comments in sanitize.js and scripts/sanitize-check.mjs now describe the image instead of the iframe.

Screenshots

Before, in a real call (Tyler's screenshot, cropped to Cue's screen):

before-call.png

After, locally at 1280×720 with a mocked /api/think: an SVG bar chart, and an HTML visual that now goes through <foreignObject>.

after-chart.png
after-html.png

Verified

  • npm run check passes.
  • Playwright against a local server, with mocked show_visual and show_diagram actions: the SVG chart draws 4 blue bars with sans-serif labels; an HTML visual (a <style> block, flex layout, & in text, a table) renders inside the image; an SVG with unclosed tags still renders (it is parsed as HTML first, as the iframe did); Mermaid diagrams are unaffected. No console errors.
  • Not checked: a real Recall call. That images paint in Recall's capture browser is an inference (the page's other images and text paint there), not yet observed for these data-URL SVGs.

Review

Skipped: a public/-only change (plus a comment in scripts/sanitize-check.mjs), per CLAUDE.md.

🤖 Generated with Claude Code

In a real Google Meet call, show_visual charts came out as a title over a
blank white sheet, while the same chart rendered fine locally. The drawing
lived in a sandboxed <iframe srcdoc>, which Recall's capture browser
evidently doesn't paint. Images do paint there.

So both kinds of visual now render as an <img> of a data: SVG URL. An SVG
drawing goes in as itself; an HTML block goes inside a <foreignObject>. The
markup is parsed as HTML and serialized as XML, because an SVG image must be
well-formed and the model's markup needn't be. The token CSS is embedded in
the SVG's <style>.

An SVG loaded as an image can't run scripts or load anything, so it keeps
the iframe's guarantee, and the sanitizer still runs first. The cost is that
an image can't fetch the brand's web fonts, so the drawing's text falls back
to Segoe UI / Helvetica / Arial instead of a serif default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
a-Fig pushed a commit that referenced this pull request Nov 13, 2026
a-Fig pushed a commit that referenced this pull request Nov 13, 2026
@a-Fig
a-Fig merged commit 6b004bf into main Nov 13, 2026
1 check passed
@a-Fig
a-Fig deleted the visual-img branch November 13, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Charts show a blank box in a real call: Recall doesn't paint the sandboxed iframe

1 participant