From 0f54ca3051d9a6871233517d0e18b96f03b7f254 Mon Sep 17 00:00:00 2001 From: Oliver Tacke Date: Sun, 6 Sep 2020 16:44:56 +0200 Subject: [PATCH] HFP-3085 Fix empty cards --- memory-game.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/memory-game.js b/memory-game.js index 4b63def..d2d102d 100644 --- a/memory-game.js +++ b/memory-game.js @@ -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(); + $('
', { id: 'h5p-intro-' + numInstances, 'class': 'h5p-memory-hidden-read', @@ -476,6 +477,13 @@ H5P.MemoryGame = (function (EventDispatcher, $) { popup.close(); }); } + else { + const $foo = $('
') + .text('No card was added to the memory game!') + .appendTo($list); + + $list.appendTo($container); + } }; /**