Merge pull request #61 from otacke/HFP-3085-Fix-empty-cards

HFP-3085 Fix empty cards
pull/63/head
Pål Jørgensen 2020-09-16 09:43:45 +02:00 committed by GitHub
commit 061ee0be19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -436,9 +436,10 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
for (var i = 0; i < cards.length; i++) {
cards[i].appendTo($list);
}
cards[0].makeTabbable();
if ($list.children().length) {
cards[0].makeTabbable();
$('<div/>', {
id: 'h5p-intro-' + numInstances,
'class': 'h5p-memory-hidden-read',
@ -476,6 +477,13 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
popup.close();
});
}
else {
const $foo = $('<div/>')
.text('No card was added to the memory game!')
.appendTo($list);
$list.appendTo($container);
}
};
/**