h5p / moodle-mod_hvp

H5P Plugin for Moodle
GNU General Public License v3.0
131 stars 169 forks source link

Moodle 4 completion information is written to embedd page #511

Open mhughes2k opened 1 year ago

mhughes2k commented 1 year ago

It appears that under Moodle 4, the activity completion information is written out to the embed.php page:

MicrosoftTeams-image

The "top" is under a Moodle 4 theme, below is under same theme on Moodle 3.

This causes issues with the embedding as the completion statement causes the page to be longer than the actual H5P content

wilenius commented 1 year ago

This is a critical problem, since in some cases, the navigation buttons are not visible (e.g. Next Card arrow in the bottom corner). Also, sometimes the iframe scrollbar is not rendered, making it impossible to proceed in the activity.

otacke commented 1 year ago

Cmp. https://moodle.org/mod/forum/discuss.php?d=442304 - potentially some moodle API change that needs to be taken care of?

kaitkrull commented 1 year ago

My suggestion would be to add the follow line of code to https://github.com/h5p/moodle-mod_hvp/blob/stable/embed.php#L89.

$PAGE->activityheader->disable();

This disables activityheader which is a new addition in Moodle 4 and which causes extra information on top of embedded H5P content. This also removes the title and description.

Fbornemann commented 11 months ago

This is also a problem for us. We do the following:

  1. Create our H5P object
  2. Get the embed code from the object created
  3. Paste the embed code to the box "Description"
  4. Tick the box "Display description on course page"

This used (on Moodle 3.11) to result in the object being show directly on the page one time. But now on Moodle 4.1 it duplicates - see photo below:

Skærmbillede 2023-10-11 kl  13 36 50
Fbornemann commented 11 months ago

Anny progress on this one?

neeesn commented 10 months ago

We still have same issue - no updates?

sehomer commented 8 months ago

We are also faced with this issue unfortunately.

jojoob commented 6 months ago

It was indirectly mentioned before but to clarify: This is about the whole activity header (completion info, description, ...?) and not just about completion info.

Independent of considering the inclusion of the activity header in the embed page a feature or a bug: The wrong sizing of the height that does not respect the additional height of the header is a bug. The static height included in the iframe tag is calculated without the header. And the h5p-resizer.js script calculates the height wrong too.

Only user applicable workaround for the wrong sizing I know of: Adjust the height for the iframe manually and don't load the resize script.

danowar2k commented 5 months ago

This is happening with our Moodle 4.1 mod_hvp. Our solution was to add the "forceembed" with value "div" to embed.php. This way, there weren't iframes inside iframes because the embed.php seems to itself add another iframe depending on the H5P library/content type. And having three iframe levels messed up resizing because each level adds its own h5p-resizer.js script.

So it was like

<document>
Moodle Content
<iframe embed.php Level 1>
Activity and Description
<iframe embed.php Level 2>
H5P Element
</iframe>
h5p-resizer.js
</iframe>
h5p-resizer.js
</document>

Maybe even more resizers ;-) And they probably messed each other up.

danowar2k commented 5 months ago

Other proposed solutions include removing the activity header on Moodle >= 4.0 when embed.php is used.

Which could be nice, but there are always people who add a H5P Element in a hidden activity and then choose to embed this activity/element in another label/page/whatever. And then they add a description with a manual to the activity or embed videos explaining the activity into the description.

Which then makes hiding the header a no-go.

danowar2k commented 5 months ago

This is happening with our Moodle 4.1 mod_hvp. Our solution was to add the "forceembed" with value "div" to embed.php. This way, there weren't iframes inside iframes because the embed.php seems to itself add another iframe depending on the H5P library/content type. And having three iframe levels messed up resizing because each level adds its own h5p-resizer.js script.

So it was like

<document>
Moodle Content
<iframe embed.php Level 1>
Activity and Description
<iframe embed.php Level 2>
H5P Element
</iframe>
h5p-resizer.js
</iframe>
h5p-resizer.js
</document>

Maybe even more resizers ;-) And they probably messed each other up.

Our solution is messing up H5P Timelines, so it isn't the way to go. Force embedding a timeline in a div seems to break the timeline javascript somehow.

Note: The timeline library also explicitly requests to be embedded in an iframe. Our solution was only tested with an Accordion, which didn't have problems.

danowar2k commented 4 months ago

We've currently switched from our old fix which broke timelines to using the pull request at https://github.com/catalyst/moodle-mod_hvp/pull/46/files.

This disables the activityheader, but at least the h5p elements now all seem to work embedded and non-embedded.

EDIT: We had to reintegrate the pull request from https://github.com/catalyst/moodle-mod_hvp/pull/23 because even with the disabled activity header, there was a race condition as to if the vertical resizing was working or not.