Skip to content

Commit

Permalink
fix(email): Fix email body height bug #1280
Browse files Browse the repository at this point in the history
Summary: Some emails were having their body height set to 0 if their height was dependent upon the iframe height -- e.g. body.height equals 100% or inherit. Added a check to see if height computed to 0px and if so, set the height to auto.

Test Plan: Tested with emails on my computer

Reviewers: juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3100
  • Loading branch information
Annie committed Jul 19, 2016
1 parent 34bf11d commit cd1f39f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal_packages/message-list/lib/email-frame.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ export default class EmailFrame extends React.Component {
let height = 0;

if (doc && doc.body) {
// Why reset the height? body.scrollHeight will always be 0 if the height
// of the body is dependent on the iframe height e.g. if height ===
// 100% in inline styles or an email stylesheet
const style = window.getComputedStyle(doc.body)
if (style.height === '0px') {
doc.body.style.height = "auto"
}
height = doc.body.scrollHeight;
}

Expand Down

0 comments on commit cd1f39f

Please sign in to comment.