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

Step error with dynamic element #162

Closed
matte00 opened this issue May 10, 2019 · 10 comments
Closed

Step error with dynamic element #162

matte00 opened this issue May 10, 2019 · 10 comments

Comments

@matte00
Copy link

matte00 commented May 10, 2019

Hi mate,

today i used your library it and it works nice with static elements. Then i tried to install your library inside my Angular 5 project but without success.
In my page i have a lot of dynamic component so when i try to define steps sequence not all elements are in the dom (*ngIf if you know somthing about Angular). This is the error message:

Element to highlight #ffl_step2 not found

So, not dynamic component are managed by your library?

Thank you for your work.
Have a nice day.

@matte00 matte00 changed the title Dynamic step Step error with dynamic component May 10, 2019
@matte00 matte00 changed the title Step error with dynamic component Step error with dynamic element May 10, 2019
@ghost
Copy link

ghost commented May 10, 2019

Sure. That's the correct case in my guess for the library to not handle this sort of issues. We had the same issue when we wrapped this package in a React component. So we implemented a step interval checker for the elements visibility and that's pretty easy.

Before we start the Walkthrough steps we make sure that all the elements are exist. (regular setInterval that get dismissed once successful, and -if you want- you can implement a timeout at some point)

@matte00
Copy link
Author

matte00 commented May 10, 2019

Thank you @Attrash-Islam for your response. But i cannot use your approach. Example:

I'm making a wizard tour of my SPA application. After the welcome message, i go to highlight edit button.
Then i need to highlight an input with id="ffl_step2" after user click on an edit button but before click the ffl_step2 not exists. It will be add to dom after click on edit button. So i can't add this step (ffl_step2) in driver.defineSteps because ffl_step2 not exists.

i can't implemented a step interval checker for the elements visibility because element ffl_step2 will be visible only after click on Edit button and i need that driver.js start wizard tour imediattly after page loaded when ffl_step2 is not defined.

@ghost
Copy link

ghost commented May 10, 2019

I see your point. In that case I'd go with multiple driver guides. Define the first tour for the first phase and the second tour for the second phase. @kamranahmedse Do you think of another approach?

@Cryde
Copy link

Cryde commented Jul 15, 2019

I'm interested how you solved this ! :)

@finalreturn
Copy link

multiple driver guides.

const driver = new Driver();
if (this.driver) {
    this.driver.defineSteps([{
        element: '#a',
        popover: {
            title: 'title',
            description: 'description',
            position: 'bottom',
            doneBtnText: 'Next'
        },
        onDeselected: () => {
            driver.preventMove()
            // router.push('/b')
            setTimeout(() = > {
                // new Driver
                // defineSteps
                // start
            }, 1500);
        }
    }])
    this.driver.start()
}

There are no other ways ?

@sarangpatel
Copy link

good. I am having same issue on hidden element. Element are visible only after some event. How to show for hidden elements?

@johnkmzhou
Copy link

multiple driver guides.

const driver = new Driver();
if (this.driver) {
    this.driver.defineSteps([{
        element: '#a',
        popover: {
            title: 'title',
            description: 'description',
            position: 'bottom',
            doneBtnText: 'Next'
        },
        onDeselected: () => {
            driver.preventMove()
            // router.push('/b')
            setTimeout(() = > {
                // new Driver
                // defineSteps
                // start
            }, 1500);
        }
    }])
    this.driver.start()
}

There are no other ways ?

The issue with this approach is that when using multiple drivers, the last element from the previous driver remains highlighted. Here is an example: https://codepen.io/johnzhou/pen/ZEOMvYd. Calling reset() on the previous driver can be used to clear the issue, but for some reason, it will remove the modal on the current driver.

@johnkmzhou
Copy link

multiple driver guides.

const driver = new Driver();
if (this.driver) {
    this.driver.defineSteps([{
        element: '#a',
        popover: {
            title: 'title',
            description: 'description',
            position: 'bottom',
            doneBtnText: 'Next'
        },
        onDeselected: () => {
            driver.preventMove()
            // router.push('/b')
            setTimeout(() = > {
                // new Driver
                // defineSteps
                // start
            }, 1500);
        }
    }])
    this.driver.start()
}

There are no other ways ?

The issue with this approach is that when using multiple drivers, the last element from the previous driver remains highlighted. Here is an example: https://codepen.io/johnzhou/pen/ZEOMvYd. Calling reset() on the previous driver can be used to clear the issue, but for some reason, it will remove the modal on the current driver.

A word of warning. If you do plan to use multiple drivers, you need to add

onNext: function () {
  driver.preventMove();
}

to the last step of the first driver. Otherwise, the first driver will remove the modal when you reach step 2 on the second driver.

@halws
Copy link

halws commented Apr 5, 2022

I've created a wrapper around driver.js to help with this problem

@kamranahmedse
Copy link
Owner

We just released v1.0 of driver.js which has been rewritten from the ground up. This issue should no longer exist. Please have a look at the docs and do let me know if you face any issues.

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

7 participants