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

onClickCapture does not work as expected in mobile #7557

Open
patheticGeek opened this issue Dec 31, 2024 · 3 comments
Open

onClickCapture does not work as expected in mobile #7557

patheticGeek opened this issue Dec 31, 2024 · 3 comments

Comments

@patheticGeek
Copy link

Provide a general summary of the issue here

onClickCapture is not working as expected in mobile devices. On desktop it is fired as expected whereas in mobile only onClick is being fired.

🤔 Expected Behavior?

onClickCapture works same as in desktop in mobile

😯 Current Behavior

onClickCapture doesnt get fired in mobile, it is being fired only in desktop.
Also in desktop it is actually fired after onClick which is the wrong order.

💁 Possible Solution

No response

🔦 Context

We have a popper which works by passing a onClickCapture fn to its child. But in some places the children of its children have onClick with stop propagation. So we cannot use onClick and need to rely on onClickCapture to trigger the opening of popper.

We are currently in between migrating to react aria components and need this to work.

🖥️ Steps to Reproduce

https://stackblitz.com/edit/stackblitz-starters-6x7elqdy

  • Open the preview in a separate tab
  • Test by clicking both the buttons in desktop and looking at console logs (onClick and onClickCapture come as expected
  • Now stimulate a mobile and refresh the page
  • The vanilla button fires both events whereas react aria one only fires onClick and not onClickCapture

Version

"react-aria": "^3.36.0"

What browsers are you seeing the problem on?

Firefox, Chrome

If other, please specify.

No response

What operating system are you using?

Ubuntu

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

@snowystinger
Copy link
Member

snowystinger commented Jan 1, 2025

This may have been fixed in #7542
Would you mind checking that it suits your needs?

@patheticGeek
Copy link
Author

Can you tell how to install the latest version from that pr?
I was not able to find any version mentioned

@yihuiliao
Copy link
Member

yihuiliao commented Jan 2, 2025

If you want to install a version, you'll probably have to wait until the PR gets merged and for a nightly to build. Otherwise, you can pull the PR down locally and add what stories you need to the storybook to see if the issue still occurs in the PR.

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

3 participants