fix(editor-modal): attach overlay to topmost same-origin window#59
Conversation
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
|
I've force-pushed the sibling PR on mod_exeweb (exelearning/mod_exeweb#46) to address @ignaciogros' review. There the root cause was the In frame (HTML4 frameset) mode: dropping it removes in one go the modal stuck at the bottom, the missing Edit button, and the broken fullscreen, because Embed already does the same with an In this PR (mod_exescorm) the situation is different:
Before I touch more code here I'd like to confirm with you:
|
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.
4786804 to
d1e570f
Compare
There was a problem hiding this comment.
Hi @erseco,
I used the "Uploaded package version", selecting a .zip file from my device instead of creating it with the plugin.
I still get the same results:
- The popup window does not take up the full screen, but it can be resized. I think that's enough. I can improve that later if you want.
- The "Edit activity" button does not appear in the parent page.
- If the SCORM is opened in “Current window” mode, it works correctly. In that case, apart from the navigation problems commented in #63, the only thing to review is this confirm message displayed when clicking the "Save to Moodle" button, but I don't know if it can be avoided:
About your questions:
- Unless you've tested it and you think it's not necessary, I think that we should keep
editor_modal.js. Maybe we can review that later, after fixing other important issues. - The "Edit with eXeLearning" button is only missing with the "Uploaded package" type.
Thank you!
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.