HFP-1716 Fix Start Button Accessibility
parent
1e335d2a33
commit
b102a2fd9f
|
@ -75,7 +75,7 @@ H5P.QuestionSet = function (options, contentId, contentData) {
|
||||||
' <% if (introPage.introduction) { %>' +
|
' <% if (introPage.introduction) { %>' +
|
||||||
' <div class="introduction"><%= introPage.introduction %></div>' +
|
' <div class="introduction"><%= introPage.introduction %></div>' +
|
||||||
' <% } %>' +
|
' <% } %>' +
|
||||||
' <div class="buttons"><a class="qs-startbutton h5p-joubelui-button h5p-button"><%= introPage.startButtonText %></a></div>' +
|
' <div class="buttons"><a href="#" class="qs-startbutton h5p-joubelui-button h5p-button"><%= introPage.startButtonText %></a></div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<% } %>' +
|
'<% } %>' +
|
||||||
'<div tabindex="-1" class="qs-progress-announcer"></div>' +
|
'<div tabindex="-1" class="qs-progress-announcer"></div>' +
|
||||||
|
@ -767,6 +767,7 @@ H5P.QuestionSet = function (options, contentId, contentData) {
|
||||||
if ($intro.length) {
|
if ($intro.length) {
|
||||||
// Show intro
|
// Show intro
|
||||||
$('.intro-page', $myDom).show();
|
$('.intro-page', $myDom).show();
|
||||||
|
$('.qs-startbutton', $myDom).focus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Show first question
|
// Show first question
|
||||||
|
@ -951,10 +952,22 @@ H5P.QuestionSet = function (options, contentId, contentData) {
|
||||||
// Allow other libraries to add transitions after the questions have been inited
|
// Allow other libraries to add transitions after the questions have been inited
|
||||||
$('.questionset', $myDom).addClass('started');
|
$('.questionset', $myDom).addClass('started');
|
||||||
|
|
||||||
$('.qs-startbutton', $myDom).click(function () {
|
$('.qs-startbutton', $myDom)
|
||||||
|
.click(function () {
|
||||||
$(this).parents('.intro-page').hide();
|
$(this).parents('.intro-page').hide();
|
||||||
$('.questionset', $myDom).show();
|
$('.questionset', $myDom).show();
|
||||||
_showQuestion(params.initialQuestion);
|
_showQuestion(params.initialQuestion);
|
||||||
|
event.preventDefault();
|
||||||
|
})
|
||||||
|
.keydown(function (event) {
|
||||||
|
switch (event.which) {
|
||||||
|
case 13: // Enter
|
||||||
|
case 32: // Space
|
||||||
|
$(this).parents('.intro-page').hide();
|
||||||
|
$('.questionset', $myDom).show();
|
||||||
|
_showQuestion(params.initialQuestion);
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue