Skip to content

fix: emails with height:100% on a wrapper element render blank below the fold#486

Open
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:fix/iframe-height-100pct-clip
Open

fix: emails with height:100% on a wrapper element render blank below the fold#486
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:fix/iframe-height-100pct-clip

Conversation

@shukiv

@shukiv shukiv commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Problem. Some HTML emails set height:100% on a full-bleed wrapper table/div rather than html/body. With the viewer's body{overflow:hidden}, this collapses documentElement.scrollHeight to the iframe's 150px default, so the scrollHeight-based auto-resize locks the iframe short and the body renders blank below the fold. A Box.co.il verification email rendered as a logo-only strip.

Fix.

  • Neutralize height:100% on any element ([style*="height:100%"]{height:auto!important}) so the body grows to its content.
  • Measure max(documentElement, body).scrollHeight, and re-measure on a fixed cadence over a short settle window — a self-clearing catch-all for late reflows (height:100% wrappers, or images that resize after onload) that doesn't depend on ResizeObserver or image load/error events firing.

Testing. Reproduced the clipped render, confirmed the iframe resizes 150→full content height with the body fully visible. Typecheck passes.

Some HTML emails set height:100% on a full-bleed wrapper table/div rather
than html/body. With the viewer's body{overflow:hidden}, this collapses
documentElement.scrollHeight to the iframe's 150px default, so the
scrollHeight-based auto-resize locks the iframe short and the body renders
blank below the fold. A Box.co.il verification email rendered as a
logo-only 150px strip.

- Neutralise height:100% on any element so the body grows to its content.
- Measure max(documentElement, body).scrollHeight, and re-measure on a
  fixed cadence over a short settle window so a late reflow (height:100%
  wrapper, or images that resize after onload) is caught even when no
  ResizeObserver/image event fires.
@rathlinus

Copy link
Copy Markdown
Member

can you share a broken eml

@shukiv

shukiv commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Sanitized repro: https://gist.github.com/shukiv/21e1fa521f68d8a578b8524e7941122e

It's the real offending email with the verification token swapped for a placeholder (no live token, no recipient PII); the HTML/CSS that triggers the clip is untouched.

Root cause: a full-bleed wrapper <table style="…height:100%…"> plus an @media only screen { html { min-height:100% } } rule in the email's own <style>. The existing html{height:auto!important} rule only neutralizes height:100% on html/body, so this wrapper-table case still collapses documentElement.scrollHeight and the iframe locks at its 150px default.

Repro: open the .eml in the viewer → renders as a logo-only ~150px strip, body blank below the fold. With this PR → full height, verify link visible.

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.

2 participants