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

getActiveElement() Updates after next and always returns the previous element #389

Closed
hsbsid opened this issue Jul 29, 2023 · 1 comment
Closed

Comments

@hsbsid
Copy link

hsbsid commented Jul 29, 2023

useEffect(() => {
    const driverObj = driver({
      popoverClass: 'driverjs-theme',
      showButtons: ['close','next'],
      allowClose: false,
      steps: [
        //{ element: '#x', popover: { title: 'Welcome', description: '.' } },
        { element: '#sidebar', popover: { title: '1', description: 'Description' }},
        { element: '#nameSection', popover: { title: '2', description: 'Description' } },
        { element: '.scrolledCard', popover: { title: '3', description: 'Description' } },
        { element: '.avaterSection', popover: { title: '4', description: 'Description' } },
      ],
      onPopoverRender: () => {
          let e = driverObj.getActiveElement();
          console.log(e);
    }, 
    });

    driverObj.drive();
  })

With the above useEffect, I am trying to print the element as the popover loads. On load the console shows undefined, on next it prints the previous element, and at done it finishes without printing the last element. I even tried following the initial .drive() with a .refresh() but no luck.

@kamranahmedse
Copy link
Owner

Fixed in 1.2.x — thank you!

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

2 participants