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

fix spotlight twice touch on touch devices #936

Closed
wants to merge 4 commits into from
Closed

Conversation

rsnzh
Copy link

@rsnzh rsnzh commented Aug 28, 2023

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
Copy link

codesandbox-ci bot commented Aug 28, 2023

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 7e53d3f:

Sandbox Source
React Configuration

@gilbarbara
Copy link
Owner

Hey @rsnzh

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

=_= added 3 commits August 29, 2023 10:38
# Conflicts:
#	src/components/Overlay.js
#	src/components/Spotlight.js
@gilbarbara
Copy link
Owner

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
Copy link
Owner

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
Copy link
Author

rsnzh commented Aug 30, 2023

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
Copy link
Owner

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
Copy link
Author

rsnzh commented Aug 31, 2023

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
Copy link
Owner

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.

@gilbarbara gilbarbara closed this Sep 16, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants