Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add onnextstepcalled and on previousstepcalled booleans #520

Closed
wants to merge 1 commit into from

Conversation

stealthAngel
Copy link

@stealthAngel stealthAngel commented Aug 8, 2024

Why We Need isNextStepCalled and isPreviousStepCalled in driver.js

What are isNextStepCalled and isPreviousStepCalled?

  • isNextStepCalled: This is a flag to indicate if the function to move to the next step has been called.
  • isPreviousStepCalled: This is a flag to indicate if the function to move to the previous step has been called.

Why are they useful?

  1. Better Tracking:

    • These flags help us keep track of user navigation. We can know if the user tried to move forward or backward, which is helpful for making UI changes during the tour.
  2. Custom Actions:

    • We can use these flags to trigger specific actions. For example, if isNextStepCalled is true, we might want to save the user's progress or show a message, go to the next step in a form wizard etc..
  3. Improved Control:

    • They give us more control over the tour. We can make decisions based on whether the user moved to the next or previous step, ensuring a smoother experience.

Sample usage

{
    element: '#form-stepper-next-button',
    popover: {
      title: 'Data',
      description:
        'Some description',
      side: 'bottom',
      align: 'center',
    },
    onDeselected(el, step, opts) {
      if (opts.state.isNextStepCalled) {
        document.getElementById("next-button");
      }
      if (opts.state.isPreviousStepCalled) {
        document.getElementById("previous-button");
      }
    },
  }

Summary

Adding isNextStepCalled and isPreviousStepCalled helps us track and control user navigation more effectively, making the tour experience better and easier to manage.


@stealthAngel stealthAngel deleted the master-mo2 branch November 7, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant