From 9094617d64cefa8d5d8d538f2d10233827c2f5aa Mon Sep 17 00:00:00 2001 From: Adam Butterworth Date: Tue, 3 Mar 2020 16:37:31 -0500 Subject: [PATCH] Prevent scrolling in chromeless view when iframed into learning mfe (#23291) TNL-7094 --- lms/templates/courseware/courseware-chromeless.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lms/templates/courseware/courseware-chromeless.html b/lms/templates/courseware/courseware-chromeless.html index 91f48f6f5a..22c18c01d6 100644 --- a/lms/templates/courseware/courseware-chromeless.html +++ b/lms/templates/courseware/courseware-chromeless.html @@ -86,7 +86,7 @@ ${HTML(fragment.foot_html())} % else: data-enable-completion-on-view-service="false" \ % endif - style="display: block; width: auto;" + style="display: block; width: auto; margin: 0;" >
${HTML(fragment.body_html())} @@ -139,6 +139,14 @@ ${HTML(fragment.foot_html())} lastHeight = newHeight; lastWidth = newWidth; + + // Within the learning microfrontend the iframe resizes to match the + // height of this document and it should never scroll. It does scroll + // ocassionally when javascript is used to focus elements on the page + // before the parent iframe has been resized to match the content + // height. This window.scrollTo is an attempt to keep the content at the + // top of the page. See TNL-7094 + window.scrollTo(0, 0); } // Create an observer instance linked to the callback function