From b85fdc6d73ae38b7f081accb4b3d455c2c4da8f2 Mon Sep 17 00:00:00 2001 From: Einar Date: Thu, 7 May 2026 12:14:34 +0200 Subject: [PATCH] Fix CommandStepper allowing forward navigation when current step is invalid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Block advancing to a later step — both via the Next button and by clicking directly on a later step tab — when the current step has validation errors. Previously, isCurrentStepInvalid was tracked but never used to guard navigation. --- Source/CommandDialog/CommandStepper.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/CommandDialog/CommandStepper.tsx b/Source/CommandDialog/CommandStepper.tsx index 4c50d91..c65bee5 100644 --- a/Source/CommandDialog/CommandStepper.tsx +++ b/Source/CommandDialog/CommandStepper.tsx @@ -207,6 +207,10 @@ export const CommandStepperContent = ({ onChangeStep?.(event); const index = (event as { index?: number }).index; if (typeof index === 'number') { + if (index > activeStep && isCurrentStepInvalid) { + return; + } + if (index > activeStep) { onVisitedStepsChange?.(new Set(visitedSteps).add(activeStep)); } @@ -219,6 +223,10 @@ export const CommandStepperContent = ({ }; const handleNext = () => { + if (isCurrentStepInvalid) { + return; + } + onVisitedStepsChange?.(new Set(visitedSteps).add(activeStep)); onActiveStepChange?.(Math.min(stepCount - 1, activeStep + 1)); };