Repository navigation
Show drawn visuals as an SVG image, not a sandboxed iframe - #93
Merged
Merged
Conversation
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]>
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.
Closes #92
Why
In a real Google Meet call,
show_visualcharts 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 throughXMLSerializer, 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 onbody.html) goes into the SVG's own<style>. The iframe, itssrcdocand its CSP are gone.<foreignObject>is still stripped by the sanitizer; only the page's own wrapper uses it.Segoe UI/Helvetica/Arial/sans-seriffallbacks, which replace the serif default. The title above the drawing is page text and keeps the brand face.visual.cssswaps the iframe rule for animgrule (object-fit: contain). The comments insanitize.jsandscripts/sanitize-check.mjsnow describe the image instead of the iframe.Screenshots
Before, in a real call (Tyler's screenshot, cropped to Cue's screen):
After, locally at 1280×720 with a mocked
/api/think: an SVG bar chart, and an HTML visual that now goes through<foreignObject>.Verified
npm run checkpasses.show_visualandshow_diagramactions: 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.Review
Skipped: a
public/-only change (plus a comment inscripts/sanitize-check.mjs), per CLAUDE.md.🤖 Generated with Claude Code