@@ -149,17 +149,16 @@ export function initMcq({ activity, state, postResults }) {
149149
150150 questionEl . appendChild ( optionsEl ) ;
151151
152- // Add "Next" button for multi-select questions
153- if ( question . isMultiSelect ) {
152+ // Add "Next" button for multi-select questions (not on last question)
153+ if ( question . isMultiSelect && qIdx < mcq . questions . length - 1 ) {
154154 const nextButtonContainer = document . createElement ( 'div' ) ;
155155 nextButtonContainer . className = 'mcq-next-button-container' ;
156156
157157 const nextButton = document . createElement ( 'button' ) ;
158158 nextButton . className = 'button button-primary mcq-next-button' ;
159159 nextButton . textContent = 'Next' ;
160160 nextButton . type = 'button' ;
161- const isLastQuestion = qIdx === mcq . questions . length - 1 ;
162- // Always visible, but disabled if no answer selected or if it's the last question
161+ // Always visible, but disabled if no answer selected
163162 nextButton . disabled = true ; // Initially disabled until answer is selected
164163 nextButton . setAttribute ( 'aria-label' , `Go to next question` ) ;
165164
@@ -293,10 +292,8 @@ export function initMcq({ activity, state, postResults }) {
293292 const nextButton = questionEl . querySelector ( '.mcq-next-button' ) ;
294293 if ( nextButton ) {
295294 const hasSelection = selectedAnswers [ questionId ] . length > 0 ;
296- const questionIndex = parseInt ( questionEl . getAttribute ( 'data-question-index' ) , 10 ) ;
297- const isLastQuestion = questionIndex === mcq . questions . length - 1 ;
298- // Disable if no answer selected or if it's the last question
299- nextButton . disabled = ! hasSelection || isLastQuestion ;
295+ // Disable if no answer selected
296+ nextButton . disabled = ! hasSelection ;
300297 }
301298 }
302299 } else {
0 commit comments