fix(editor-modal): attach overlay to topmost same-origin window#59
Open
fix(editor-modal): attach overlay to topmost same-origin window#59
Conversation
When the embedded eXeLearning editor modal is opened from inside a small frame (e.g. a popup-mode launcher or any embedded iframe), the overlay was previously appended to that cramped frame's body. The result was a dialog "stuck at the bottom" of the frame with the Save/Close buttons rendered out of reach. Walk up the window chain to the topmost same-origin window before mounting, so the overlay always covers the full viewport. Cross-origin parents fall back to the current window. Mirrors exelearning/mod_exeweb#46.
ignaciogros
requested changes
May 6, 2026
Collaborator
There was a problem hiding this comment.
When entering a SCORM package in popup mode by clicking the “Enter” button:
- The popup window does not take up the full screen, but it can be resized. That seems correct.
- The “Edit activity” button does not appear in the parent page.
- If the SCORM is opened in “Current window” mode, it works correctly.
Tested in Moodle 4.5.10 (Build: 20260216) with https://github.com/erseco/alpine-moodle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mirrors the editor-modal half of exelearning/mod_exeweb#46.
In
amd/src/editor_modal.jsthe overlay was appended to the current frame'sdocument.body. When the Edit button was clicked from a small embedded frame (e.g. a popup-mode launcher), the modal got rendered inside that cramped frame and the Save / Close buttons ended up out of reach — described in mod_exeweb#43 as the dialog "stuck at the bottom and hard to close".This walks the parent chain to the topmost same-origin window before mounting, so the overlay always covers the full viewport. Cross-origin parents fall back to the current window.
Note: the missing-Edit-button part of mod_exeweb#43 does not reproduce here —
mod/exescorm/view.phpalready renders the Edit button before launching the popup window, regardless ofpopupsetting. Only the modal-positioning fix is needed.Test plan
exescormactivity with Display = In a new window (popup) and the embedded type. Confirm the Edit button appears on the parent view and the modal opens full-viewport.Refs exelearning/mod_exeweb#46
Refs exelearning/mod_exeweb#43
Moodle Playground Preview
The changes in this pull request can be previewed and tested using a Moodle Playground instance.