Skip to content

feat: adds scrollToXBlock message handler for cms iframe view#36478

Merged
farhaanbukhsh merged 2 commits intoopenedx:masterfrom
open-craft:tecoholic/BB-9656-introduce-scrollToXBlock-for-iframe-in-studio
Apr 15, 2025
Merged

feat: adds scrollToXBlock message handler for cms iframe view#36478
farhaanbukhsh merged 2 commits intoopenedx:masterfrom
open-craft:tecoholic/BB-9656-introduce-scrollToXBlock-for-iframe-in-studio

Conversation

@tecoholic
Copy link
Contributor

Description

This commit adds a new message handler to the XBlockContainerPage CMS view, that allows the MFE to send a signal to the IFrame and scroll to a specific XBlock.

Useful information to include:

  • Which edX user roles will this change impact? "Course Author"

PoC showing an MFE plugin that makes use of this message handler to scroll the page to specific XBlocks.

Screencast_20250403_155811.webm

Supporting information

Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions.
Be sure to check they are publicly readable, or if not, repeat the information here.

Testing instructions

By default, the Authoring MFE uses legacy Studio UI for the Course Unit page. In order to test the
PR changes, enable the MFE's course unit page.

  1. Create a Course Waffle Flag in the LMS admin (/admin/waffle_utils/waffleflagcourseoverridemodel/) with:
    • Waffle Flag: contentstore.new_studio_mfe.use_new_unit_page
    • Course ID: The ID of the course you are using for testing.
    • Override Choice: Force ON
    • Enabled: Check
  2. Add a .env.private in the MFE repo with the following
ENABLE_UNIT_PAGE=true
  1. Now go to the Studio and open the "Unit page" of a course.
  2. Use the inspector and copy a XBlock ID for testing. (preferable one that's in the bottom of the page)
  3. Now switch to the JS Console and use the following snippet to post a message. The page should scroll to the XBlock
let blockId = "<your-block-id>";
let iframe = document.getElementsByName("xblock-iframe")[0];
iframe.contentWindow.postMessage({type: "scrollToXBlock", payload: { locator: blockId }}, target="http://studio.local.openedx.io:8001")

Make sure that the context it "top" pointing to the MFE in the console, and adjust the target value to your studio URL.
image

Deadline

None

Other information

Include anything else that will help reviewers and consumers understand the change.

  • Does this change depend on other changes elsewhere?
    NO

  • Any special concerns or limitations? For example: deprecations, migrations, security, or accessibility.
    N/A

  • If your database migration can't be rolled back easily.

This commit adds a new message handler to the XBlockContainerPage
CMS view, that allows the MFE to send a signal to the IFrame
and scroll to a specific XBlock.
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Apr 4, 2025
@openedx-webhooks
Copy link

Thanks for the pull request, @tecoholic!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Apr 4, 2025
@tecoholic tecoholic requested a review from farhaanbukhsh April 4, 2025 08:36
@tecoholic tecoholic self-assigned this Apr 4, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions Apr 7, 2025
Copy link
Member

@farhaanbukhsh farhaanbukhsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

  • ✅ I tested this on local tutor stack
  • ✅ I read through the code
  • ❌ I checked for accessibility issues
  • ❌ Includes documentation

@farhaanbukhsh farhaanbukhsh merged commit 9f299df into openedx:master Apr 15, 2025
49 checks passed
@farhaanbukhsh farhaanbukhsh deleted the tecoholic/BB-9656-introduce-scrollToXBlock-for-iframe-in-studio branch April 15, 2025 16:30
@github-project-automation github-project-automation bot moved this from Ready for Review to Done in Contributions Apr 15, 2025
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@tecoholic tecoholic restored the tecoholic/BB-9656-introduce-scrollToXBlock-for-iframe-in-studio branch April 18, 2025 00:32
tonybusa pushed a commit to tonybusa/edx-platform that referenced this pull request Apr 23, 2025
…x#36478)

This commit adds a new message handler to the XBlockContainerPage
CMS view, that allows the MFE to send a signal to the IFrame
and scroll to a specific XBlock.
UsamaSadiq pushed a commit that referenced this pull request May 14, 2025
This commit adds a new message handler to the XBlockContainerPage
CMS view, that allows the MFE to send a signal to the IFrame
and scroll to a specific XBlock.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants