@@ -38,8 +38,8 @@ class ActionPanel extends React.Component<ActionPanelProps, {}> {
3838
3939 let stepNumber = this . props . pressedStepIndex + 1 ;
4040 const cachedCurrentStepLoopData = currentStep . cache ;
41- if ( cachedCurrentStepLoopData != null && cachedCurrentStepLoopData . get ( 'containingLoopPosition' ) != null ) {
42- stepNumber = cachedCurrentStepLoopData . get ( 'containingLoopPosition' ) ;
41+ if ( cachedCurrentStepLoopData != null ) {
42+ stepNumber = cachedCurrentStepLoopData . getContainingLoopPosition ( ) ;
4343 }
4444
4545 let stepName = '' ;
@@ -78,15 +78,14 @@ class ActionPanel extends React.Component<ActionPanelProps, {}> {
7878 if ( this . props . pressedStepIndex > 0 ) {
7979 const prevStep = this . props . programSequence . getProgramStepAt ( this . props . pressedStepIndex - 1 ) ;
8080 const cachedPreviousStepLoopData = prevStep . cache ;
81- const prevStepName = prevStep . block ;
8281 // When previous step is startLoop, aria-label communicates that movePrevious will move out of the current loop
83- if ( prevStepName === 'startLoop' && currentStep . block !== 'endLoop' ) {
82+ if ( prevStep . block === 'startLoop' && currentStep . block !== 'endLoop' ) {
8483 return this . props . intl . formatMessage (
8584 { id : 'CommandInfo.previousStep.startLoop' } ,
8685 { loopLabel : prevStep . label }
8786 ) ;
8887 // When previous step is endLoop, aria-label communicates that movePrevious will move into a loop
89- } else if ( prevStepName === 'endLoop' ) {
88+ } else if ( prevStep . block === 'endLoop' ) {
9089 return this . props . intl . formatMessage (
9190 { id : 'CommandInfo.previousStep.endLoop' } ,
9291 { loopLabel : prevStep . label }
@@ -107,15 +106,13 @@ class ActionPanel extends React.Component<ActionPanelProps, {}> {
107106 )
108107 }
109108 // When previous step is wrapped in a loop, aria-label communicates position within a loop
110- } else if ( cachedPreviousStepLoopData != null &&
111- cachedPreviousStepLoopData . get ( 'containingLoopPosition' ) != null &&
112- cachedPreviousStepLoopData . get ( 'containingLoopLabel' ) != null ) {
109+ } else if ( cachedPreviousStepLoopData != null ) {
113110 return this . props . intl . formatMessage (
114111 { id : 'CommandInfo.previousStep.inLoop' } ,
115112 {
116- previousStepNumber : cachedPreviousStepLoopData . get ( 'containingLoopPosition' ) ,
117- command : this . props . intl . formatMessage ( { id : `Command.${ prevStepName } ` } ) ,
118- loopLabel : cachedPreviousStepLoopData . get ( 'containingLoopLabel' )
113+ previousStepNumber : cachedPreviousStepLoopData . getContainingLoopPosition ( ) ,
114+ command : this . props . intl . formatMessage ( { id : `Command.${ prevStep . block } ` } ) ,
115+ loopLabel : cachedPreviousStepLoopData . getContainingLoopLabel ( ) ,
119116 }
120117 )
121118 // When previous step is a movements step and not in a loop, aria-label communicates position within the program
@@ -124,7 +121,7 @@ class ActionPanel extends React.Component<ActionPanelProps, {}> {
124121 { id : 'CommandInfo.previousStep' } ,
125122 {
126123 previousStepNumber : this . props . pressedStepIndex ,
127- command : this . props . intl . formatMessage ( { id : `Command.${ prevStepName } ` } )
124+ command : this . props . intl . formatMessage ( { id : `Command.${ prevStep . block } ` } )
128125 }
129126 ) ;
130127 }
@@ -137,15 +134,14 @@ class ActionPanel extends React.Component<ActionPanelProps, {}> {
137134 if ( this . props . pressedStepIndex < ( this . props . programSequence . getProgramLength ( ) - 1 ) ) {
138135 const nextStep = this . props . programSequence . getProgramStepAt ( this . props . pressedStepIndex + 1 ) ;
139136 const cachedNextStepLoopData = nextStep . cache ;
140- const nextStepName = nextStep . block ;
141137 // When next step is startLoop, aria-label communicates that moveNext will move into a loop
142- if ( nextStepName === 'startLoop' ) {
138+ if ( nextStep . block === 'startLoop' ) {
143139 return this . props . intl . formatMessage (
144140 { id : 'CommandInfo.nextStep.startLoop' } ,
145141 { loopLabel : nextStep . label }
146142 ) ;
147143 // When next step is endLoop, aria-label communicates that moveNext will move out of the current loop
148- } else if ( nextStepName === 'endLoop' && currentStep . block !== 'startLoop' ) {
144+ } else if ( nextStep . block === 'endLoop' && currentStep . block !== 'startLoop' ) {
149145 return this . props . intl . formatMessage (
150146 { id : 'CommandInfo.nextStep.endLoop' } ,
151147 { loopLabel : nextStep . label }
@@ -166,15 +162,13 @@ class ActionPanel extends React.Component<ActionPanelProps, {}> {
166162 ) ;
167163 }
168164 // When next step is wrapped in a loop, aria-label communicates position within a loop
169- } else if ( cachedNextStepLoopData != null &&
170- cachedNextStepLoopData . get ( 'containingLoopPosition' ) != null &&
171- cachedNextStepLoopData . get ( 'containingLoopLabel' ) != null ) {
165+ } else if ( cachedNextStepLoopData != null ) {
172166 return this . props . intl . formatMessage (
173167 { id : 'CommandInfo.nextStep.inLoop' } ,
174168 {
175- nextStepNumber : cachedNextStepLoopData . get ( 'containingLoopPosition' ) ,
176- command : this . props . intl . formatMessage ( { id : `Command.${ nextStepName } ` } ) ,
177- loopLabel : cachedNextStepLoopData . get ( 'containingLoopLabel' )
169+ nextStepNumber : cachedNextStepLoopData . getContainingLoopPosition ( ) ,
170+ command : this . props . intl . formatMessage ( { id : `Command.${ nextStep . block } ` } ) ,
171+ loopLabel : cachedNextStepLoopData . getContainingLoopLabel ( )
178172 }
179173 ) ;
180174 // When next step is a movements step and not in a loop, aria-label communicates position within the program
0 commit comments