gilbarbara / react-joyride

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

fix spotlight twice touch on touch devices #936

Closed rsnzh closed 1 year ago

rsnzh commented 1 year ago

1.remove css pointer-events and mousemove event 2.add click method on spotlight component if set spotlightClicks true then trigger target element click event

codesandbox-ci[bot] commented 1 year ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 7e53d3f46ac82d6b9831ae96babc2a34207217ac:

Sandbox Source
React Configuration
gilbarbara commented 1 year ago

Hey @rsnzh

You are changing the code style of the updated files, that's not acceptable.

gilbarbara commented 1 year ago

Hey @rsnzh CI is still failing.

Anyway, I couldn't replicate the behavior you mentioned. Load this URL: https://nwdc5n.csb.app/controlled, and when you click the menu through the spotlight, it is only called once.

Also, I'm against imperative actions, such as element.click(). This can lead to other problems...

gilbarbara commented 1 year ago

Also, if you check the Modal demo, the spotlight click allows the input to be selected, so it's not triggering a click in the element.

rsnzh commented 1 year ago

Hey @rsnzh CI is still failing.

Anyway, I couldn't replicate the behavior you mentioned. Load this URL: https://nwdc5n.csb.app/controlled, and when you click the menu through the spotlight, it is only called once.

Also, I'm against imperative actions, such as element.click(). This can lead to other problems...

You can reproduce twice clicks on touch devices, just as issues #855 #861 . element.click() might not be the best, but is what I currently think of .

Also, if you check the Modal demo, the spotlight click allows the input to be selected, so it's not triggering a click in the element.

The result is not the same on touch devices and pc browsers. maybe add the spotlightFocus props, if set true trigger element.focus()

gilbarbara commented 1 year ago

You can reproduce twice clicks on touch devices, just as issues #855 #861 .

Yeah, I tested in Chrome and Safari on an iPhone. I closed these issues since I can't replicate them. Can you try it again?

rsnzh commented 1 year ago

Yeah, I tested in Chrome and Safari on an iPhone. I closed these issues since I can't replicate them. Can you try it again?

I try it on Android Edge and Chrome Desktop and not working expected. edge: 1 chrome: 2

gilbarbara commented 1 year ago

The solution doesn't cover all cases. The target isn't necessarily the element the user wants to be triggered and imperative calls to the click method could throw an error.