Skip to content

Fix: Set H5P's external embed flag to false explicitly - #3306

Open
otacke wants to merge 1 commit into
cerpus:masterfrom
otacke:fix-h5p-external-embed
Open

otacke wants to merge 1 commit into
cerpus:masterfrom
otacke:fix-h5p-external-embed

Conversation

@otacke

@otacke otacke commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

When merged in, will set the H5P.externalEmbed to fix detection of H5P.fullscreenSupported which then fixes broken fullscreen button behavior on iPhones.

Note

I never managed to get Edlib running locally, so this is experimental! I am not sure if window.H5P will already be set when trying to call it. That you may want to check. Setting the value should be done before the content is initiated.

Background

H5P integrations usually use H5P core to render the non-embed iframe contents:

To reproduce the underlying issue

Edlib

Visit https://hub.h5p.ndla.no/content/01kcp5fawcfbc2g9j5e39vp7t9 showing H5P.EscapeRoom content
a) On any system but an iPhone, the content will show a fullscreen button in the upper right-hand corner. ✅
b) On an iPhone, the content will not show a fullscreen button in the upper right-hand corner. ❌

WordPress (for comparison)

Visit https://www.olivertacke.de/labs/2024/07/23/ndla-brings-you-yet-another-h5p-content-type-escape-room/
On any system, including an iPhone, the content will show a fullscreen button in the upper right-hand corner. ✅

Background

  1. Inside H5P.init(), all iframes that have not yet been initialized will filled with content
    (https://github.com/h5p/h5p-php-library/blob/1e21b7a2da4ae9c4f1f9e61f7ae1038f8850fb82/js/h5p.js#L380-L406)
  2. As part of getHeadTags() called in (https://github.com/h5p/h5p-php-library/blob/1e21b7a2da4ae9c4f1f9e61f7ae1038f8850fb82/js/h5p.js#L392), H5P.externalEmbed will be set to false explicitly (https://github.com/h5p/h5p-php-library/blob/1e21b7a2da4ae9c4f1f9e61f7ae1038f8850fb82/js/h5p.js#L437).

That never happens on Edlib.

As a consequence, the computation of the value for H5P.fullscreenSupported is impacted (https://github.com/h5p/h5p-php-library/blob/1e21b7a2da4ae9c4f1f9e61f7ae1038f8850fb82/js/h5p.js#L77).

This matters on iPhones which do not support document.fullscreenEnabled (cmp. https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenEnabled#browser_compatibility).

In that case (if ignoring potential override flags for disabling support deliberately)H5P.fullscreenSupported is only determined by !(H5P.isFramed && H5P.externalEmbed !== false) and H5P.externalEmbed !== false is the crucial condition.

If H5P.externalEmbed is not set to false explicitly when in a non-embedded context, then fullscreen support is supposed to be off, and then iPhones do not show the fullscreen button of content types (e.g. Course Presentation, Interactive Video, GameMap, etc.) as it being displayed depends on H5P.fullscreenSupported to be true.

@github-actions github-actions Bot added the Component: Content Author All issues that affect content author (sourcecode/apis/contentauthor) label Nov 6, 2026
@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.35%. Comparing base (e08fe9d) to head (7c5b167).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3306      +/-   ##
============================================
+ Coverage     61.85%   66.35%   +4.50%     
+ Complexity     3660     2670     -990     
============================================
  Files           411      240     -171     
  Lines         15867    11970    -3897     
============================================
- Hits           9814     7943    -1871     
+ Misses         6053     4027    -2026     
Components Coverage Δ
Content Author 66.35% <100.00%> (+0.01%) ⬆️
Hub ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

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

Labels

Component: Content Author All issues that affect content author (sourcecode/apis/contentauthor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant