@@ -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 = '' ;
@@ -74,9 +74,8 @@ class ActionPanel extends React.Component<ActionPanelProps, {}> {
7474 if ( this . props . pressedStepIndex > 0 ) {
7575 const prevStep = this . props . programSequence . getProgramStepAt ( this . props . pressedStepIndex - 1 ) ;
7676 const cachedPreviousStepLoopData = prevStep . cache ;
77- const prevStepName = prevStep . block ;
7877 // When previous step is startLoop, aria-label communicates that movePrevious will move out of the current loop
79- if ( prevStepName === 'startLoop' && currentStep . block !== 'endLoop' ) {
78+ if ( prevStep . block === 'startLoop' && currentStep . block !== 'endLoop' ) {
8079 return this . props . intl . formatMessage ( { id : 'ActionPanel.action.moveToPreviousStep.startLoop' } ,
8180 {
8281 stepNumber,
@@ -85,7 +84,7 @@ class ActionPanel extends React.Component<ActionPanelProps, {}> {
8584 }
8685 ) ;
8786 // When previous step is endLoop, aria-label communicates that movePrevious will move into a loop
88- } else if ( prevStepName === 'endLoop' ) {
87+ } else if ( prevStep . block === 'endLoop' ) {
8988 return this . props . intl . formatMessage ( { id : 'ActionPanel.action.moveToPreviousStep.endLoop' } ,
9089 {
9190 stepNumber,
@@ -110,16 +109,14 @@ class ActionPanel extends React.Component<ActionPanelProps, {}> {
110109 )
111110 }
112111 // When previous step is wrapped in a loop, aria-label communicates position within a loop
113- } else if ( cachedPreviousStepLoopData != null &&
114- cachedPreviousStepLoopData . get ( 'containingLoopPosition' ) != null &&
115- cachedPreviousStepLoopData . get ( 'containingLoopLabel' ) != null ) {
112+ } else if ( cachedPreviousStepLoopData != null ) {
116113 return this . props . intl . formatMessage ( { id : 'ActionPanel.action.moveToPreviousStep.inLoop' } ,
117114 {
118115 stepNumber,
119116 stepName,
120- previousStepNumber : cachedPreviousStepLoopData . get ( 'containingLoopPosition' ) ,
121- command : this . props . intl . formatMessage ( { id : `Command.${ prevStepName } ` } ) ,
122- loopLabel : cachedPreviousStepLoopData . get ( 'containingLoopLabel' ) ,
117+ previousStepNumber : cachedPreviousStepLoopData . getContainingLoopPosition ( ) ,
118+ command : this . props . intl . formatMessage ( { id : `Command.${ prevStep . block } ` } ) ,
119+ loopLabel : cachedPreviousStepLoopData . getContainingLoopLabel ( ) ,
123120 }
124121 )
125122 // When previous step is a movements step and not in a loop, aria-label communicates position within the program
@@ -129,7 +126,7 @@ class ActionPanel extends React.Component<ActionPanelProps, {}> {
129126 stepNumber,
130127 stepName,
131128 previousStepNumber : this . props . pressedStepIndex ,
132- command : this . props . intl . formatMessage ( { id : `Command.${ prevStepName } ` } )
129+ command : this . props . intl . formatMessage ( { id : `Command.${ prevStep . block } ` } )
133130 }
134131 ) ;
135132 }
@@ -148,9 +145,8 @@ class ActionPanel extends React.Component<ActionPanelProps, {}> {
148145 if ( this . props . pressedStepIndex < ( this . props . programSequence . getProgramLength ( ) - 1 ) ) {
149146 const nextStep = this . props . programSequence . getProgramStepAt ( this . props . pressedStepIndex + 1 ) ;
150147 const cachedNextStepLoopData = nextStep . cache ;
151- const nextStepName = nextStep . block ;
152148 // When next step is startLoop, aria-label communicates that moveNext will move into a loop
153- if ( nextStepName === 'startLoop' ) {
149+ if ( nextStep . block === 'startLoop' ) {
154150 return this . props . intl . formatMessage ( { id : 'ActionPanel.action.moveToNextStep.startLoop' } ,
155151 {
156152 stepNumber,
@@ -159,7 +155,7 @@ class ActionPanel extends React.Component<ActionPanelProps, {}> {
159155 }
160156 ) ;
161157 // When next step is endLoop, aria-label communicates that moveNext will move out of the current loop
162- } else if ( nextStepName === 'endLoop' && currentStep . block !== 'startLoop' ) {
158+ } else if ( nextStep . block === 'endLoop' && currentStep . block !== 'startLoop' ) {
163159 return this . props . intl . formatMessage ( { id : 'ActionPanel.action.moveToNextStep.endLoop' } ,
164160 {
165161 stepNumber,
@@ -184,16 +180,14 @@ class ActionPanel extends React.Component<ActionPanelProps, {}> {
184180 ) ;
185181 }
186182 // When next step is wrapped in a loop, aria-label communicates position within a loop
187- } else if ( cachedNextStepLoopData != null &&
188- cachedNextStepLoopData . get ( 'containingLoopPosition' ) != null &&
189- cachedNextStepLoopData . get ( 'containingLoopLabel' ) != null ) {
183+ } else if ( cachedNextStepLoopData != null ) {
190184 return this . props . intl . formatMessage ( { id : 'ActionPanel.action.moveToNextStep.inLoop' } ,
191185 {
192186 stepNumber,
193187 stepName,
194- nextStepNumber : cachedNextStepLoopData . get ( 'containingLoopPosition' ) ,
195- command : this . props . intl . formatMessage ( { id : `Command.${ nextStepName } ` } ) ,
196- loopLabel : cachedNextStepLoopData . get ( 'containingLoopLabel' )
188+ nextStepNumber : cachedNextStepLoopData . getContainingLoopPosition ( ) ,
189+ command : this . props . intl . formatMessage ( { id : `Command.${ nextStep . block } ` } ) ,
190+ loopLabel : cachedNextStepLoopData . getContainingLoopLabel ( )
197191 }
198192 ) ;
199193 // When next step is a movements step and not in a loop, aria-label communicates position within the program
0 commit comments