@@ -564,7 +564,6 @@ var privates = {
564
564
wizard . bind ( "keyup.steps" , privates . keyUpHandler ) ;
565
565
}
566
566
567
- wizard . find ( ".steps a" ) . bind ( "click.steps" , privates . stepClickHandler ) ; // TODO: Try to move this code line to renderTitle
568
567
wizard . find ( ".actions a" ) . bind ( "click.steps" , privates . paginationClickHandler ) ;
569
568
} ,
570
569
@@ -588,11 +587,14 @@ var privates = {
588
587
// Create a content wrapper and copy HTML from the intial wizard structure
589
588
var contentWrapper = $ ( document . createElement ( options . contentContainerTag ) )
590
589
. addClass ( "content" ) . html ( wizard . html ( ) ) ,
590
+ stepsWrapper = $ ( document . createElement ( options . stepsContainerTag ) )
591
+ . addClass ( "steps" ) . append ( $ ( "<ul role=\"tablist\"></ul>" ) ) ,
591
592
stepTitles = contentWrapper . children ( options . headerTag ) ,
592
593
stepContents = contentWrapper . children ( options . bodyTag ) ;
593
594
594
595
// Transform the wizard wrapper and remove the inner HTML
595
- wizard . attr ( "role" , "application" ) . addClass ( options . cssClass ) . empty ( ) . append ( contentWrapper ) ;
596
+ wizard . attr ( "role" , "application" ) . addClass ( options . cssClass ) . empty ( )
597
+ . append ( stepsWrapper ) . append ( contentWrapper ) ;
596
598
597
599
// Add WIA-ARIA support
598
600
stepContents . each ( function ( index )
@@ -603,19 +605,9 @@ var privates = {
603
605
// Make the start step visible
604
606
stepContents . eq ( state . currentIndex ) . showAria ( ) ;
605
607
606
- var stepsWrapper = $ ( document . createElement ( options . stepsContainerTag ) )
607
- . addClass ( "steps" ) . append ( $ ( "<ul role=\"tablist\"></ul>" ) ) ;
608
- wizard . prepend ( stepsWrapper ) ;
609
-
610
608
stepTitles . each ( function ( index )
611
609
{
612
610
privates . renderTitle ( wizard , options , state , $ ( this ) , index ) ;
613
-
614
- // TODO: Try to move this code block to renderTitle
615
- if ( index < state . currentIndex )
616
- {
617
- wizard . find ( ".steps li" ) . eq ( index ) . disableAria ( ) . addClass ( "done" ) ;
618
- }
619
611
} ) ;
620
612
621
613
privates . refreshStepNavigation ( wizard , options , state ) ;
@@ -737,6 +729,11 @@ var privates = {
737
729
stepItem . disableAria ( ) ;
738
730
}
739
731
732
+ if ( state . currentIndex > index )
733
+ {
734
+ stepItem . enableAria ( ) . addClass ( "done" ) ;
735
+ }
736
+
740
737
header . setId ( uniqueHeaderId ) . attr ( "tabindex" , "-1" ) . addClass ( "title" ) ;
741
738
742
739
if ( index === 0 )
@@ -759,6 +756,9 @@ var privates = {
759
756
{
760
757
stepCollection . find ( "li" ) . removeClass ( "last" ) . eq ( index ) . addClass ( "last" ) ;
761
758
}
759
+
760
+ // Register click event
761
+ stepItem . children ( "a" ) . bind ( "click.steps" , privates . stepClickHandler ) ;
762
762
} ,
763
763
764
764
/**
0 commit comments