gilbarbara / react-joyride

Create guided tours in your apps
https://react-joyride.com/
MIT License
6.88k stars 529 forks source link

Spotlightclicks not triggering any joyride event #500

Closed edwinbbu closed 5 years ago

edwinbbu commented 5 years ago

🐛 Bug Report

button on click is not triggering any joyride action/event in controlled mode.

To Reproduce

Create joyride navigation with options: spotlightClicks: true, stepIndex: 2

Expected behavior

Button click to trigger action='next' in the joyride callback event

edwinbbu commented 5 years ago

In reference to issue #447 , the answer provided for closing the issue is: Yes, use the callback prop in V2. https://github.com/gilbarbara/react-joyride/blob/master/docs/callback.md

But the issue is that I have to manually trigger the joyride from the onclick event

<a className="btn btn-ss-primary" id="onboarding1" onClick={
            (e) => {
                this.props.incrementStepCount({
                  stepIndex: this.props.onboardingTour.stepIndex + 1,
                  run: true,
                });
            }}>

I have given id="onboarding1" as target in steps array. The joyride callback is triggered automatically on button click

gilbarbara commented 5 years ago

It's impossible to know what is happening without seeing some code, so I need a reproduction example, preferably on codesandbox.

gilbarbara commented 5 years ago

BTW, do you really need to have a controlled tour with stepIndex? A standard tour usually doesn't need it...

edwinbbu commented 5 years ago

I have created a sample code in codesandbox . I am expecting the button click the automatically trigger any joyride event @gilbarbara

gilbarbara commented 5 years ago

The custom button below the title?

Since it is outside the Joyride UI it is your job to handle the click. This library can't access elements outside its domain. When you set a target, it is used as the origin for Joyride's positioning and highlighting but the content inside it is not used.