From 601ae585e184d1bb9b3ea0ee8d7ae830c72dbe3d Mon Sep 17 00:00:00 2001 From: thomasmars Date: Mon, 3 Oct 2016 13:06:01 +0200 Subject: [PATCH 1/6] Disable backwards navigation. Show dots, but they have no action when backward navigation is disabled. Always show/enable full navigation in solution mode. Only show forward button when a question has been answered. Remove navigation button if question has been answered, then retried within the question's logic. HFP-8 --- js/questionset.js | 74 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 63a18fb..634a296 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -39,7 +39,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { ' <% } %>' + ' ' + ' <% } else if (progressType == "textual") { %>' + @@ -323,7 +327,12 @@ H5P.QuestionSet = function (options, contentId, contentData) { */ var toggleDotsNavigation = function (enable) { $('.progress-dot', $myDom).each(function () { + $(this).toggleClass('disabled', !enable); $(this).attr('aria-disabled', enable ? 'false' : 'true'); + // Remove tabindex + if (!enable) { + $(this).attr('tabindex', '-1'); + } }); }; @@ -441,9 +450,10 @@ H5P.QuestionSet = function (options, contentId, contentData) { label += ', ' + texts.currentQuestionText; } + var disabledTabindex = params.disableBackwardsNavigation && !showingSolutions; $el.toggleClass('current', isCurrent) .attr('aria-label', label) - .attr('tabindex', isCurrent ? 0 : -1); + .attr('tabindex', isCurrent && !disabledTabindex ? 0 : -1); }; var _displayEndGame = function () {