Skip to content

stepNumber is incorrect on showStep event when no transition #112

@Mimetis

Description

@Mimetis

Describe the bug
When setting no transition, the stepNumber is incorrect on showStep event

To Reproduce
Steps to reproduce the behavior:

this.smartWizard.smartWizard({
 transition: {
       animation: 'none', // Effect on navigation, none/fade/slide-horizontal/slide-vertical/slide-swing
       speed: '400', // Transion animation speed
       easing: '' // Transition animation easing. Not supported without a jQuery easing plugin
   },
}

this.smartWizard.on("showStep", async (e, anchorObject, stepNumber, stepDirection, stepPosition) => {
  console.log(stepNumber)
}

Expected behavior
stepNumber is incorrect, since the affectation is too late before event is raised

Source

I believe the problem comes from here:

 this._doStepAnimation(idx, function () {
  // Fix height with content
  _this5._fixHeight(idx); // Trigger "showStep" event


  _this5._triggerEvent("showStep", [selStep, _this5.current_index, stepDirection, stepPosition]);
}); // Update the current index


this.current_index = idx; // Set the buttons based on the step

the this.current_index = idx; is happening after the event is triggered _this5._triggerEvent("showStep" ....)

With any animation, it's fine since the triggered is launched after the anim, so far the current_index is correctly set
But without animation, the affectation happens after the event

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions