From 13121256821bf7e9937a68c941d00bcf86cd3209 Mon Sep 17 00:00:00 2001 From: Kevin Pham Date: Tue, 13 Jul 2021 13:15:43 +1000 Subject: [PATCH] Remove focus events on when showing a card Resolves #102 --- src/scripts/h5p-dialogcards-card.js | 17 ----------------- src/scripts/h5p-dialogcards.js | 3 --- 2 files changed, 20 deletions(-) diff --git a/src/scripts/h5p-dialogcards-card.js b/src/scripts/h5p-dialogcards-card.js index 1e626d5..69adeba 100644 --- a/src/scripts/h5p-dialogcards-card.js +++ b/src/scripts/h5p-dialogcards-card.js @@ -468,23 +468,6 @@ class Card { } } - /** - * Set focus to a given card. - * @param {boolean} force If true, don't wait for transition. - */ - setCardFocus(force) { - if (force === true) { - this.$cardTextArea.focus(); - } - else { - // Wait for transition, then set focus - const $card = this.getDOM(); - $card.one('transitionend', () => { - $card.focus() - }); - } - } - /** * Stop audio of card. */ diff --git a/src/scripts/h5p-dialogcards.js b/src/scripts/h5p-dialogcards.js index 561b9e5..d27d174 100644 --- a/src/scripts/h5p-dialogcards.js +++ b/src/scripts/h5p-dialogcards.js @@ -608,7 +608,6 @@ class Dialogcards extends H5P.EventDispatcher { this.currentCardId = targetPosition; this.updateNavigation(); - this.cards[this.currentCardId].setCardFocus(); }; /** @@ -642,7 +641,6 @@ class Dialogcards extends H5P.EventDispatcher { this.createDOM(); this.updateNavigation(); - this.cards[this.currentCardId].setCardFocus(true); this.trigger('resize'); }; @@ -672,7 +670,6 @@ class Dialogcards extends H5P.EventDispatcher { this.showAllAudio(); this.cards[this.currentCardId].resizeOverflowingText(); - this.cards[this.currentCardId].setCardFocus(); }; /**