-
Notifications
You must be signed in to change notification settings - Fork 122
Description
Bug
The widget renderer iframe keeps expanding vertically when the generated content includes elements that fill available space (e.g. height: 100%, height: 100vh, or canvas elements that scale to their container).
Root Cause
There's a feedback loop between the iframe height and the content height measurement:
- Inside the iframe,
reportHeight()measurescontent.offsetHeightand posts it to the parent (widget-renderer.tsx:459-463) - The parent sets the iframe height to
e.data.height + 8— adding 8px padding each cycle (widget-renderer.tsx:576) - If the content has elements that fill available space (common with Canvas/Three.js/SVG visualizations using
100vhor100%), the content expands to match the now-taller iframe ResizeObserverfires again, reporting the larger height- Parent adds another +8px → content grows → repeat
The periodic setInterval(reportHeight, 200) running for 15 seconds (widget-renderer.tsx:468-469) accelerates this, causing ~8px growth every 200ms (~600px over the interval lifetime).
Reproduction
Ask the agent to create any visualization that uses viewport-relative or percentage-based heights (e.g. "I want to understand the difference between BFS and DFS. Create an interactive comparison on a node graph."). The widget will visibly expand over time with growing empty space below the actual content.
Possible Fixes
- Remove the
+ 8from the height setter or apply it as CSS padding on the wrapper instead of inflating the measurement - Measure
scrollHeightof individual children rather thanoffsetHeightof the container, so the measurement is independent of iframe dimensions - Debounce and cap consecutive increases — if the reported height keeps growing without new content changes, stop updating
- Set
max-heightoroverflow: autoon the iframe content wrapper to prevent viewport-filling elements from driving unbounded growth