Skip to content

Why is it not effective to bind the click event on the 'react-joyride__spotlight' dom? #1096

Answered by gilbarbara
xyyit9 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @xyyit9

When you move your cursor over the spotlight, the overlay changes its pointer-events to none, so the click goes through, and the element behind the spotlight receives it "without interference".
Changing the overlay pointer-events to auto triggers its close listener.
If not using the disableOverlayClose: true prop, the event never reaches the portal.

So add the disableOverlayClose prop on your step(s).
Also, ensure the only style change is: .react-joyride__overlay { cursor: pointer !important; pointer-events: auto !important; }.

And then:

if (portal) {
    portal.style.cursor = 'pointer';      // This won't work since the overlay gets the cursor event, so it's using its styles.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by xyyit9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants