Why isn’t H5P content type X available as a subcontent option in content type Y?

One of the standout features of H5P is its modular approach to content types. This means that once you’ve coded a content type, you can effortlessly integrate it as a subcontent type within another content type. To illustrate, if you wish to incorporate Combination Lock into a Column, all it takes is a single entry in the semantics.json file of Column.

By simply extending the list of machine names file with H5P.CombinationLock 1.0, you’ve completed the process. The H5P core takes care of the rest. Remarkably, even if the Combination Lock content type isn’t installed on the platform, there’s no need to worry. The H5P core gracefully handles this situation by excluding it from the options list, ensuring a seamless experience without any disruptions.

If the process is so straightforward, why isn’t every content type automatically added to all compound content types? Well, in practice, it’s not as straightforward as it may seem. While a single line could theoretically suffice, several reasons may explain why this hasn’t been universally implemented. Here are a few considerations to ponder.

The content type does not work as subcontent

Assumptions about the environment

At times, content types operate smoothly in isolation but encounter issues as subcontent. Consider the following examples to understand the complexities:

  • Attempt placing version 1.5 of Agamotto inside an Interactive Book and open the left-hand side menu. A glitch emerges – the knob of Agamotto‘s slider bar is misaligned when released. This stems from Agamotto assuming to take up 100% of the H5P iframe, an assumption disrupted when the menu expands. Although fixed in version 1.5.4 in January 2021 (now Agamotto 1.6.4 exists), H5P Group continues serving version 1.5.2. The misalignment flaw still persists :-/
  • Resizing is a major challenge in H5P, which also extends to the topic of subcontent. The mechanisms used in the composite content type may interfere with those of the sub-content.
  • Some content types assume immediate attachment to the webpage upon instantiation. However, this isn’t guaranteed when utilized as subcontent. Unexpected issues surface; for instance, Timeline and Advanced Fill in the Blanks may fail to appear, crashing as subcontent.

These examples underscore the intricacies involved when integrating content types as subcontent, revealing the need for careful consideration and potential adjustments.

Missing implementation of contracts, missing functionality

Certain content types, like Question Set, use subcontent types, but these must meet specific criteria. Those are outlined in a designated contract, referred to as the “question type contract” for Question Set. It is utilized by other compound content types as well, however. These criteria ensure seamless integration and functionality. For instance, a subcontent type should offer essential functions such as getScore for obtaining the current score and resetTask to reset the subcontent. These requirements collectively form the question type contract.

If a potential subcontent type fails to adhere to this contract, it won’t function within Question Set or other compound content types seeking score information, etc. An example is the Arithmetic Quiz, which, despite dealing with scores and user-initiated restarts, doesn’t implement the question type contract, rendering it incompatible with Question Set.

Moreover, if a compound content type supports resuming, the subcontent type must (or at least should) also support it. This consistency is crucial to prevent user confusion. Although this aspect may not be explicitly stated in the question type contract, H5P Group incorporated the getCurrentState function for this purpose in late 2023.

Consequently, certain content types, like Image Sequencing, Find the Hotspot, Flashcards, or Branching Scenario, are ruled out as subcontent options due to their inability to fulfill the specified contract or resume functionality requirements.

One extra: The Iframe Embedder will rarely be found, because it is not responsive – and depending on the scenario, could impose security issues.

Missing accessibility

A straightforward explanation for excluding a content type as subcontent is its potential inaccessibility. Maintainers prioritize the overall accessibility of their parent content type, and this might be the case why Find the Words is excluded from Column. Notably, Find the Words lacks keyboard accessibility and fails to provide an alternative representation, making its inclusion incompatible with the overarching commitment to accessibility.

Nesting

A unique consideration for restricting certain content types as subcontent is the challenge posed by nesting subcontent.

The H5P core can only manage one version of an H5P library (or content type) simultaneously. This limitation becomes apparent when dealing with nested subcontents, where the overarching goal is to avoid clashes between different versions. The potential for content crashes arises if there are subcontent types of two different versions across all the subcontents.

Consider the example of a Column using Course Presentation in version 1.0 and True False in version 1.3. If the Course Presentation of version 1.0 contains True False 1.2 content, it creates a version conflict for the True False question. If an author integrates one True False into a Column while also employing a Course Presentation that includes its True False Question, complications may arise. The author must ensure that the Column uses True False 1.2 or adapt Course Presentation to incorporate True False 1.3. Sounds complicated? It’s tedious work, at least. Also, you may not be the maintainer of all the content types involved, so your options may be limited.

Nesting introduces another pitfall. For instance, placing an Accordion within another Accordion could result in a peculiar user experience, prompting the exclusion of this option due to potential usability issues.

The visual interface of the compound content type has issues

Certain H5P content types come with a distinct editor widget, diverging from the standard dropdown menu provided by the H5P core. Instead, these types feature a visual interface equipped with buttons for each subcontent type.

A standout example is Course Presentation, a compound content type with an expansive visual editor. The toolbar, brimming with buttons, extends even further with a rightmost button that reveals additional options. However, given the limited space, adding more subcontent types becomes a challenge.

While one option is to rework the visual editor, this solution would demand similar efforts for Interactive Video, Branching Scenario, and Virtual Tour – a notably inefficient approach.

Fortunately, there’s a prospective solution in the works. In the foreseeable (or is it distant?) future, a singular button will replace the clutter, opening the H5P Hub. This centralized hub will streamline the process of selecting desired subcontent types. Additionally, it will offer the convenience of uploading existing content and repurposing content from the H5P OER Hub.

The content type may not have felt relevant as subcontent

Occasionally, a content type can be employed as a subcontent type from a technical standpoint, but the author didn’t initially foresee its utility. Consider Game Map, crafted for generating game-like content with a variety of subcontents. These subcontents aren’t mandated to be scored; they can encompass simple stages featuring only images or videos. But what about Questionnaire?

Excluding Questionnaire from Game Map wasn’t due to technical limitations but stemmed from the author’s initial focus on game-like elements. The idea of incorporating a Questionnaire wasn’t initially seen as valuable. However, when someone expressed interest in using it for that purpose, it prompted a reevaluation.

The content type may not be maintained anymore

Regrettably, it’s a reality that contributors sometimes create content types but lack the time to sustain them. This absence of ongoing maintenance means these content types won’t receive new features or crucial bug fixes if issues arise.

Using such unmaintained content types as subcontent can lead to complications. Initial testing might have overlooked bugs, or updates to the parent content type may necessitate adjustments to the subcontent type. If the latter isn’t actively maintained, the burden falls on the parent content type’s maintainer. It raises the question of responsibility for someone else’s code – a situation that isn’t always desirable.

As of now, content types released on the H5P Hub, not developed by the H5P Group and no longer maintained, include:

So, if you want those as subcontent and know someone who might want to pick up the mantle …

The maintainer is lacking resources

A primary obstacle to incorporating content types as subcontent is often the limited resources on the maintainer’s end. The process of introducing new subcontent types involves a comprehensive check:

  • Verification of relevant contracts implementation,
  • Assurance of seamless resizing functionality,
  • Identification of potential issues when the content operates as subcontent, and more.

This meticulous evaluation demands time and resources, which may not be readily available without cost. While automated testing of user flows could be beneficial, its implementation in content types presents a significant task in its own right.

Conclusion

The provided list of reasons aims to highlight that while H5P’s modularity offers the flexibility of using content types as subcontents within compound content types, several obstacles persist. It’s crucial to recognize that this list might not cover all potential challenges. This post serves as an awareness-raising effort, not as an excuse, shedding light on the reasons why certain H5P content types may not be readily available as subcontent options.