Skip to content

Commit a94e21e

Browse files
committed
fix(pf4): fix bug in wizard navigation toolbar
In Patternfly 4, the WizardNavItem component `step` prop is "the step passed into the onNavItemClick callback". http://v4-archive.patternfly.org/v4/components/wizard#wizardnavitem In Patternfly 5, onNavItemClick no longer exists. Instead, there is an onClick callback which expects the index of the step to be navigated to. https://www.patternfly.org/components/wizard/#wizardnavitem However, filtering the navSchema like so: `.filter((field) => field.primary)` results in substeps with field.primary===false being dropped. Practically, this means the 2nd substep and those following it. Therefore, the index provided by `.map((step, ind) => ...` is incorrect. The correct index can still be found from `step.index`.
1 parent 3b7ffcb commit a94e21e

File tree

1 file changed

+2
-2
lines changed
  • packages/pf4-component-mapper/src/wizard/wizard-components

1 file changed

+2
-2
lines changed

packages/pf4-component-mapper/src/wizard/wizard-components/wizard-nav.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const WizardNavigationInternal = React.memo(
2424
<WizardNav>
2525
{navSchema
2626
.filter((field) => field.primary)
27-
.map((step, ind) => {
27+
.map((step) => {
2828
const substeps = step.substepOf && navSchema.filter((field) => field.substepOf === step.substepOf);
2929

3030
const isValid = valid && !validating;
@@ -37,7 +37,7 @@ const WizardNavigationInternal = React.memo(
3737
isDisabled={isValid ? maxStepIndex < step.index : step.index > activeStepIndex}
3838
onClick={(e) => {
3939
e.preventDefault();
40-
jumpToStep(ind, isValid);
40+
jumpToStep(step.index, isValid);
4141
}}
4242
step={step.index}
4343
type="button"

0 commit comments

Comments
 (0)