@@ -36,7 +36,7 @@ H5P.Flashcards = (function ($, XapiGenerator) {
36
36
results : "Results" ,
37
37
ofCorrect : "@score of @total correct" ,
38
38
showResults : "Show results" ,
39
- retry : "Retry" ,
39
+ retry : "Retry" ,
40
40
cardAnnouncement : 'Incorrect answer. Correct answer was @answer' ,
41
41
pageAnnouncement : 'Page @current of @total' ,
42
42
correctAnswerAnnouncement : '@answer is correct!'
@@ -208,7 +208,6 @@ H5P.Flashcards = (function ($, XapiGenerator) {
208
208
var $inner = this . $container . html (
209
209
'<div class="h5p-description" id="flashcards-description' + '-' + descId + '" title="' + this . options . description + '">' + this . options . description + '</div>' +
210
210
'<div class="h5p-progress"></div>' +
211
- // '<div class="h5p-inner" role="region" aria-labelledby="flashcards-description' + '-' + descId + '" aria-roledescription="carousel"></div>' +
212
211
'<div class="h5p-inner" role="region" ' + '-' + descId + '></div>' +
213
212
'<div class="h5p-navigation">' +
214
213
'<button type="button" class="h5p-button h5p-previous h5p-hidden" tabindex="0" title="' + this . options . previous + '" aria-label="' + this . options . previous + '"></button>' +
@@ -329,7 +328,6 @@ H5P.Flashcards = (function ($, XapiGenerator) {
329
328
330
329
// Generate a new flashcards html and add it to h5p-inner
331
330
var $card = $ (
332
- // '<div role="group" aria-roledescription="slide" aria-labelledby="h5p-flashcard-card-' + cardId + '" class="h5p-card h5p-animate' + (index === 0 ? ' h5p-current' : '') + '"> ' +
333
331
'<div role="group" id="cardgroup"' + '" class="h5p-card h5p-animate' + ( index === 0 ? ' h5p-current' : '' ) + '"> ' +
334
332
'<div class="h5p-cardholder">' +
335
333
'<div class="h5p-imageholder">' +
@@ -569,10 +567,7 @@ H5P.Flashcards = (function ($, XapiGenerator) {
569
567
* @param {H5P.jQuery } $card
570
568
* Class to add to existing current card.
571
569
*/
572
- C . prototype . setCurrent = function ( $card ) {
573
-
574
- this . $prev = this . $current ;
575
-
570
+ C . prototype . setCurrent = function ( $card ) {
576
571
// Remove from existing card.
577
572
if ( this . $current ) {
578
573
this . $current . find ( '.h5p-textinput' ) . attr ( 'tabindex' , '-1' ) ;
@@ -581,23 +576,22 @@ H5P.Flashcards = (function ($, XapiGenerator) {
581
576
this . $current . find ( '.h5p-icon-button' ) . attr ( 'tabindex' , '-1' ) ;
582
577
}
583
578
584
- // Set new card
579
+ // Set new card
585
580
this . $current = $card ;
586
581
587
582
/* We can't set focus on anything until the transition is finished.
588
583
If we do, iPad will try to center the focused element while the transition
589
584
is running, and the card will be misplaced */
590
585
591
- // Handle focus shift and screen reader announcement
592
- $card . one ( 'transitionend' , function ( ) {
593
- if ( $card . hasClass ( 'h5p-current' ) && ! $card . find ( '.h5p-textinput' ) [ 0 ] . disabled ) {
594
- $card . find ( '.h5p-textinput' ) . focus ( ) ;
595
- }
596
- setTimeout ( function ( ) {
597
- this . announceCurrentPage ( ) ;
598
- } . bind ( this ) , 50 ) ; // Adjust the delay as necessary
599
-
600
- } . bind ( this ) ) ;
586
+ // Handle focus shift and screen reader announcement
587
+ $card . one ( 'transitionend' , function ( ) {
588
+ if ( $card . hasClass ( 'h5p-current' ) && ! $card . find ( '.h5p-textinput' ) [ 0 ] . disabled ) {
589
+ $card . find ( '.h5p-textinput' ) . focus ( ) ;
590
+ }
591
+ setTimeout ( function ( ) {
592
+ this . announceCurrentPage ( ) ;
593
+ } . bind ( this ) , 50 ) ; // Adjust the delay as necessary
594
+ } . bind ( this ) ) ;
601
595
602
596
// Update card classes
603
597
$card . removeClass ( 'h5p-previous h5p-next' ) ;
@@ -620,7 +614,7 @@ H5P.Flashcards = (function ($, XapiGenerator) {
620
614
$card . find ( '.h5p-check-button' ) . attr ( 'tabindex' , '0' ) ;
621
615
$card . find ( '.h5p-icon-button' ) . attr ( 'tabindex' , '0' ) ;
622
616
$card . find ( '.joubel-tip-container' ) . attr ( 'tabindex' , '0' ) ;
623
- } ;
617
+ } ;
624
618
625
619
/**
626
620
* Announces current page to assistive technologies
@@ -629,7 +623,7 @@ H5P.Flashcards = (function ($, XapiGenerator) {
629
623
const pageText = this . options . pageAnnouncement
630
624
. replace ( '@current' , this . $current . index ( ) + 1 )
631
625
. replace ( '@total' , this . options . cards . length . toString ( ) ) ;
632
- this . $pageAnnouncer . text ( pageText ) ;
626
+ this . $pageAnnouncer . text ( pageText ) ;
633
627
} ;
634
628
635
629
/**
0 commit comments