From 8830a5db70003bed93db82a7d7bc46f49e7852bb Mon Sep 17 00:00:00 2001 From: Mel Ludowise Date: Fri, 6 Mar 2026 00:51:11 -0500 Subject: [PATCH] Fix autoResize reporting viewport height when content is taller fit-content clamps to the containing block's available size. For , that's the iframe viewport, so when content exceeds the viewport height the SDK reported the viewport height instead of the true content height, causing internal scrolling instead of iframe growth. max-content has no available-space constraint and correctly reports the intrinsic content height in both directions (shrink and grow). Width stays fit-content to preserve responsive wrapping. --- src/app.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app.ts b/src/app.ts index 8e133d64c..fb952a23a 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1119,13 +1119,14 @@ export class App extends Protocol { scheduled = false; const html = document.documentElement; - // Measure actual content size by temporarily setting html to fit-content. - // This shrinks html to fit body (including body margins), giving us the - // true minimum size needed by the content. + // Measure actual content size by temporarily overriding html sizing. + // Width uses fit-content so content wraps at the host-provided width. + // Height uses max-content because fit-content would clamp to the viewport + // height when content is taller than the iframe, causing internal scrolling. const originalWidth = html.style.width; const originalHeight = html.style.height; html.style.width = "fit-content"; - html.style.height = "fit-content"; + html.style.height = "max-content"; const rect = html.getBoundingClientRect(); html.style.width = originalWidth; html.style.height = originalHeight;