From ce15a15c8e0d982b664dfde8eb49c091048a1110 Mon Sep 17 00:00:00 2001 From: rider_griffin Date: Thu, 11 Mar 2021 14:08:18 -0700 Subject: [PATCH 1/2] call registerDomElements() in constructor to render questions without needing to see them --- js/multichoice.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/multichoice.js b/js/multichoice.js index c23afd73..2f777188 100644 --- a/js/multichoice.js +++ b/js/multichoice.js @@ -462,6 +462,9 @@ H5P.MultiChoice = function (options, contentId, contentData) { } }; + //Create question DOM on instantiation to calculate score accurately + this.registerDomElements(); + this.showAllSolutions = function () { if (solutionsVisible) { return; From aa8bd6a1923c70913f25d25ebf78f83ae8327ae2 Mon Sep 17 00:00:00 2001 From: rider_griffin Date: Tue, 16 Mar 2021 14:13:41 -0700 Subject: [PATCH 2/2] moves registerDomElements call to bottom of constructor to give aria roles chance to instantiate --- js/multichoice.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/multichoice.js b/js/multichoice.js index 2f777188..429a0ead 100644 --- a/js/multichoice.js +++ b/js/multichoice.js @@ -462,8 +462,6 @@ H5P.MultiChoice = function (options, contentId, contentData) { } }; - //Create question DOM on instantiation to calculate score accurately - this.registerDomElements(); this.showAllSolutions = function () { if (solutionsVisible) { @@ -1118,6 +1116,10 @@ H5P.MultiChoice = function (options, contentId, contentData) { this.getTitle = function () { return H5P.createTitle((this.contentData && this.contentData.metadata && this.contentData.metadata.title) ? this.contentData.metadata.title : 'Multiple Choice'); }; + + this.registerDomElements(); + + }; H5P.MultiChoice.prototype = Object.create(H5P.Question.prototype);