diff --git a/app/internal_packages/message-list/lib/email-frame.tsx b/app/internal_packages/message-list/lib/email-frame.tsx index 1443ff5f5..bd29ea4a1 100644 --- a/app/internal_packages/message-list/lib/email-frame.tsx +++ b/app/internal_packages/message-list/lib/email-frame.tsx @@ -153,16 +153,25 @@ export default class EmailFrame extends React.Component { // If documentElement has a scroll height, prioritize that as height // If not, fall back to body scroll height by setting it to auto let height = 0; + let width = 0; if (doc && doc.documentElement && doc.documentElement.scrollHeight > 0) { + width = doc.documentElement.scrollWidth; height = doc.documentElement.scrollHeight; } else if (doc && doc.body) { const style = window.getComputedStyle(doc.body); if (style.height === '0px') { doc.body.style.height = 'auto'; } + width = doc.body.scrollWidth; height = doc.body.scrollHeight; } + if (width > iframeEl.clientWidth) { + // the message will scroll horizontally, and we need to add 20px to the height of + // the iframe to allow for it's scrollbar. Otherwise it covers the last line of text. + height += 20; + } + this._iframeComponent.setHeightQuietly(height); this._iframeWrapperEl.style.height = `${height}px`; };