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

Changing option dontShowAgain during execution is not reflected in the next steps #2037

Open
jboivin-done opened this issue Mar 7, 2024 · 0 comments

Comments

@jboivin-done
Copy link

jboivin-done commented Mar 7, 2024

Description

I would like to be able to control if a step includes the "don't show again" checkbox or not. Like this, I could have generic initial and final steps that would include the checkbox, but the ones in between. Trying to set the option during the onbeforechange event doesn't work even if I use this.refresh() or this.refresh(true).

Expected Behavior

The "don't show again" checkbox is hidden or shown when I change the value of the option while executing. In the example below, it should show the checkbox only on the first step.

Actual Behavior

Only the initial value is used.

Example (recommended)

Using your page https://introjs.com/docs/examples/basic/dont-show-again, you copy/paste the following code to see what I'm trying to achieve. This is only an experimental code and thus only works once. Each execution needs to refresh the page, paste the code and then click on run

introJs().setOption("dontShowAgain", true).onbeforechange(
function() {
  try {
    if (test === true) {
      console.log('SSS - Not first execution');
      this.setOption("dontShowAgain", false);
      this.refresh(true);
    }
  } catch (ex) {console.log('EEE - First execution');}  
  test = true;
  
  console.log('HHH - All executions');
}
).start();

Fix location

This could be fix without having to use refresh (which I realized is only to gather steps from HTML and in my case I am adding them in TypeScript... so.) at this place:

//show the tooltip

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

No branches or pull requests

1 participant