feat!: Make MFE scroll content instead of iFrame when scrollToXblock is called

This commit is contained in:
Sara Burns
2025-08-08 11:52:19 -04:00
committed by Farhaan Bukhsh
parent be438f1554
commit 405282c17e

View File

@@ -175,7 +175,10 @@ function($, _, Backbone, gettext, BasePage,
this.createComponent(this, xblockElement, data);
break;
case 'scrollToXBlock':
document.getElementById(data.payload.locator)?.scrollIntoView({behavior: "smooth"});
window.parent.postMessage({
type: 'xblock-scroll',
offset: document.getElementById(data.payload.locator).offsetTop
}, document.referrer);
break;
default:
console.warn('Unhandled message type:', data.type);