Skip to content

Commit 405282c

Browse files
saraburns1farhaanbukhsh
authored andcommitted
feat!: Make MFE scroll content instead of iFrame when scrollToXblock is called
1 parent be438f1 commit 405282c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cms/static/js/views/pages/container.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ function($, _, Backbone, gettext, BasePage,
175175
this.createComponent(this, xblockElement, data);
176176
break;
177177
case 'scrollToXBlock':
178-
document.getElementById(data.payload.locator)?.scrollIntoView({behavior: "smooth"});
178+
window.parent.postMessage({
179+
type: 'xblock-scroll',
180+
offset: document.getElementById(data.payload.locator).offsetTop
181+
}, document.referrer);
179182
break;
180183
default:
181184
console.warn('Unhandled message type:', data.type);

0 commit comments

Comments
 (0)