gjbarnard / moodle-format_topcoll

Collapsed Topics course format for Moodle.
http://docs.moodle.org/en/Collapsed_Topics_course_format
GNU General Public License v3.0
35 stars 60 forks source link

Embed dissappears with Collpased topics course format #36

Closed Jarvil closed 10 months ago

Jarvil commented 6 years ago

Hello,

There is a problem with Collapsed topic and H5P Embed -feature (iframe).

Tested with Moodle 3.3, Mod_hvp 1.6 and format_topcoll 3.3.1.0 (2017042202) and Clean-theme

Steps to repeat;

Embed H5P activity to some section f.ex section 1 Click "close all" to fold all sections Edit some random activity on the course (no need to edit it) and select "save and return to course" Expand the section 1 and notice how the embedded H5P-activity isn't displayed, it only displays the bottom bar of the embedded H5P-activity If you refresh the page with F5 then the embedded activity is displayed. So the problem is that embedded H5P-activity isn't displayed if you fold all sections -> edit something -> return to the cousre frontpage until you manually refresh the page.

h5p1 h5p2 h5p3 h5p4 h5p5 h5p6 h5p7 h5p8 h5p9 h5p10 h5p11

gjb2048 commented 6 years ago

Noted, will look when I get time.

Jarvil commented 6 years ago

Great!

gjb2048 commented 6 years ago

Yes I can replicate. But there is a problem. The H5P mod script is a dynamic one that orchestrates itself on page load to generate the markup required to the available space (there is a resize script to cope with window resize). But if the script detects that the content is hidden (i.e. display: none) then it does not render it. When the container 'display' is changed by CT then the script is unaware that it needs to recalculate things etc.

Looking at h5p-resizer.js with:

  // Let h5p iframes know we're ready!
  var iframes = document.getElementsByTagName('iframe');
  var ready = {
    context: 'h5p',
    action: 'ready'
  };
  for (var i = 0; i < iframes.length; i++) {
    if (iframes[i].src.indexOf('h5p') !== -1) {
      iframes[i].contentWindow.postMessage(ready, '*');
    }
  }

there might be a way of telling the H5P frames when the state changes and therefore to redraw.

gjb2048 commented 6 years ago

Do you know?

To be continued....

gjb2048 commented 6 years ago

Marked as an 'Enhancement' as not a fault with the code but integration with a 3rd party plugin.

Jarvil commented 6 years ago

Hello,

I'm sorry but I don't know H5P myself any better.

Jarvil commented 6 years ago

You should see;

https://github.com/h5p/h5p-moodle-plugin/issues/190

gjb2048 commented 5 years ago

Is this still an issue?

gjb2048 commented 3 years ago

@Jarvil Is this still an issue?

gjb2048 commented 10 months ago

No more information forthcoming, closing.