From 086e26ea693748dd0494ba9850b71c784865fe4c Mon Sep 17 00:00:00 2001 From: "Adolfo R. Brandes" Date: Wed, 29 Sep 2021 10:58:50 -0300 Subject: [PATCH] fix: avoid onresize height loop We set a global `min-height: 100%` for the body element (a common strategy to allow for background images to fill the viewport), but this is undesirable for iframes where the `window.onresize` is used to programmatically adjust the iframe height. Because `onresize` will fire when the body adjusts itself as per its `min-height: 100%`, in certain situations this will lead to an infinite resizing loop. This is notably visible when: * Rendering the video block when using Firefox: this causes the iframe size to jiggle indefinitely. * Rendering the HTML block when there are empty block elements (such as `

`) that have a vertical margin set (which happens to be the default to HTML blocks): this will cause the iframe to increase in height infinitely. By adding an inline `min-height: auto` on the wrapping body element, this overrides the Studio-served CSS, and thus fixes the problem. --- cms/templates/content_libraries/xblock_iframe.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cms/templates/content_libraries/xblock_iframe.html b/cms/templates/content_libraries/xblock_iframe.html index ca9f39d1ff..47966bc4cd 100644 --- a/cms/templates/content_libraries/xblock_iframe.html +++ b/cms/templates/content_libraries/xblock_iframe.html @@ -125,7 +125,10 @@ {{ fragment.head_html | safe }} - + + {{ fragment.body_html | safe }}