Make readspeakers announce current question of total when changing question.

HFJ-2041
pull/5/head
Thomas Marstrander 2016-06-27 11:43:00 +02:00
parent c9fed3ddf1
commit 653d12a85e
9 changed files with 58 additions and 1 deletions

View File

@ -125,6 +125,13 @@
transition: none;
}
.qs-progress-announcer {
height: 0;
width: 0;
position: absolute;
overflow: hidden;
}
.h5p-question .h5p-question-prev,
.h5p-question .h5p-question-finish,
.h5p-question .h5p-question-next {

View File

@ -31,6 +31,7 @@ H5P.QuestionSet = function (options, contentId) {
' <div class="buttons"><a class="qs-startbutton h5p-joubelui-button h5p-button"><%= introPage.startButtonText %></a></div>' +
'</div>' +
'<% } %>' +
'<div tabindex="-1" class="qs-progress-announcer"></div>' +
'<div class="questionset<% if (introPage.showIntroPage) { %> hidden<% } %>">' +
' <% for (var i=0; i<questions.length; i++) { %>' +
' <div class="question-container"></div>' +
@ -88,7 +89,8 @@ H5P.QuestionSet = function (options, contentId) {
finishButton: 'Finish',
textualProgress: 'Question: @current of @total questions',
jumpToQuestion: 'Jump to question %d',
questionLabel: 'Question'
questionLabel: 'Question',
readSpeakerProgress: 'Question @current of @total'
},
endGame: {
showResultPage: true,
@ -224,6 +226,17 @@ H5P.QuestionSet = function (options, contentId) {
$('.progress-dot:eq(' + questionNumber +')', $myDom).addClass('current');
}
// Announce question number of total, must use timeout because of buttons logic
setTimeout(function () {
var humanizedProgress = params.texts.readSpeakerProgress
.replace('@current', (currentQuestion + 1).toString())
.replace('@total', questionInstances.length.toString());
$('.qs-progress-announcer', $myDom)
.html(humanizedProgress)
.focus();
}, 0);
// Remember where we are
_updateButtons();
self.trigger('resize');

View File

@ -83,6 +83,11 @@
{
"label": "Copyright dialog question label",
"default": "Question"
},
{
"label": "Readspeaker progress",
"description": "May use @current and @total question variables",
"default": "Question @current of @total"
}
]
},

View File

@ -88,6 +88,11 @@
{
"label": "Copyright dialog question label",
"default": "Question"
},
{
"label": "Readspeaker progress",
"description": "May use @current and @total question variables",
"default": "Question @current of @total"
}
]
},

View File

@ -83,6 +83,11 @@
{
"label": "Copyright dialog question label",
"default": "Question"
},
{
"label": "Readspeaker progress",
"description": "May use @current and @total question variables",
"default": "Question @current of @total"
}
]
},

View File

@ -83,6 +83,11 @@
{
"label": "Copyright dialog question label",
"default": "Question"
},
{
"label": "Readspeaker progress",
"description": "May use @current and @total question variables",
"default": "Question @current of @total"
}
]
},

View File

@ -85,6 +85,11 @@
{
"label": "Opphavsrett spørsmål-etikett",
"default": "Spørsmål"
},
{
"label": "Fremdriftstekst for hjelpemiddelteknologi",
"description": "Kan bruke @current og @total variabler",
"default": "Deloppgave @current av @total"
}
]
},

View File

@ -85,6 +85,11 @@
{
"label": "Opphavsrett spørsmål-etikett",
"default": "Spørsmål"
},
{
"label": "Fremdriftstekst for hjelpemiddelteknologi",
"description": "Kan bruke @current og @total variabler",
"default": "Deloppgave @current av @total"
}
]
},

View File

@ -165,6 +165,13 @@
"type": "text",
"label": "Copyright dialog question label",
"default": "Question"
},
{
"name": "readSpeakerProgress",
"type": "text",
"label": "Readspeaker progress",
"description": "May use @current and @total question variables",
"default": "Question @current of @total"
}
]
},