diff --git a/components/sandbox/index.js b/components/sandbox/index.js index 2b52f3d1467225..f78982c8bafb82 100644 --- a/components/sandbox/index.js +++ b/components/sandbox/index.js @@ -73,15 +73,16 @@ export default class Sandbox extends wp.element.Component { ( function() { var observer; - if ( ! window.MutationObserver || ! document.body || ! window.top ) { + if ( ! window.MutationObserver || ! document.body || ! window.parent ) { return; } function sendResize() { - window.top.postMessage( { + var clientBoundingRect = document.body.getBoundingClientRect(); + window.parent.postMessage( { action: 'resize', - width: document.body.offsetWidth, - height: document.body.offsetHeight + width: clientBoundingRect.width, + height: clientBoundingRect.height }, '*' ); } @@ -126,7 +127,7 @@ export default class Sandbox extends wp.element.Component {