Skip to content

fix(editor-modal): attach overlay to topmost same-origin window#59

Open
erseco wants to merge 2 commits intomainfrom
fix/editor-modal-host-window
Open

fix(editor-modal): attach overlay to topmost same-origin window#59
erseco wants to merge 2 commits intomainfrom
fix/editor-modal-host-window

Conversation

@erseco
Copy link
Copy Markdown
Collaborator

@erseco erseco commented Apr 29, 2026

Summary

Mirrors the editor-modal half of exelearning/mod_exeweb#46.

In amd/src/editor_modal.js the overlay was appended to the current frame's document.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.php already renders the Edit button before launching the popup window, regardless of popup setting. Only the modal-positioning fix is needed.

Test plan

  • Open an exescorm activity 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.
  • Confirm Save / Close buttons in the modal are reachable and Escape still closes it.
  • Confirm Display = current window still behaves as before.

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.

Preview in Moodle Playground

⚠️ The embedded eXeLearning editor is not included in this preview. You can install it from Modules > eXeLearning SCORM > Configure using the "Download & Install Editor" button. All other module features (ELPX upload, viewer, preview) work normally.

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.
@erseco erseco requested a review from ignaciogros April 29, 2026 16:32
@erseco erseco self-assigned this Apr 29, 2026
Copy link
Copy Markdown
Collaborator

@ignaciogros ignaciogros left a comment

Choose a reason for hiding this comment

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants