-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Mobile Item Selection Fails Starting from Version 3.22.3 of @react-aria/interactions #7157
Comments
It appears that this issue is also affecting all pressable elements. Button and Link started having unreliable behavior in this version. Takes several taps to get them to work. |
I've reproduced this on my phone as well, will need to dig to see what exactly is going on. @shift4id Are these React Aria Component/React Spectrum Buttons and Links that are having problems or ones create from the hooks directly? |
@LFDanLu — I'm using |
I'm experiencing the same with |
I also encountered this issue. The problem is that the click event on mobile devices does not work. When I reverted to version 3.22.2, everything worked fine. I used NextUI's <Tooltip content="content">
<span
onClick={() => {}}
onKeyDown={() => {}}
aria-label="aria-label"
role="button"
tabIndex={0}
className="custom-styles"
/>
</Tooltip> Currently, my temp solution is using pnpm overrides:
|
build: update dependencies Add override for `@react-aria/interactions` version 3.22.3 -> 3.22.2, until adobe/react-spectrum#7157 is resolved.
Thank you for the additional examples everyone. I did some digging and this seems to be the problematic line: react-spectrum/packages/@react-aria/interactions/src/usePress.ts Lines 530 to 532 in db60bab
li /path within the svg /etc which then hits the preventDefault because they fail this check.
@elianarlivingston For your example it could perhaps be argued that |
That should have been currentTarget rather than target. |
Opened #7190 to fix this for Links. However, this will not change the current behavior where @AnYiEE I'm not entirely familiar with NextUI's tooltip but I what I can see from their implementation, the span you show in your example is the tooltip trigger element correct? If so, from what I can tell there shouldn't be anything from |
Hello, I'm trying to import my existing repository on codesandbox.io, but it failed to compile, reporting that a dependency cannot find a file it needs. If you have time, could you try cloning my repository locally to reproduce the problem (I just tried and can still reproduce it). Here are the steps to reproduce:
More details: The version changes of |
Hi! Thank you so much for the help. We're also a library, and we need to access the click event as it's part of our current public API. For this reason, it's crucial for us to be able to intercept the event when using onAction. Is there any way to directly access the click event from onAction without compromising the existing functionality? We would really appreciate any suggestions that help us maintain compatibility with our API. Thanks again for the support! |
@AnYiEE I see in your pnpm lockfile that you have duplicates of some of our packages installed. This can lead to strange bugs. I suggest reducing them all to a single copy and seeing if that fixes your problems. It's a pretty common issue due to how package managers work because they were originally built for node code, not javascript front ends. |
@snowystinger My project does not directly use @react-aria, so I may not be able to intervene too much in the versions of dependencies of other dependencies, as this would make things complicated. For me, the simplest solution is, as I mentioned in my previous reply, to lock the version of @react-aria/interactions to 3.22.2, and the problem is resolved. |
You should be able to control it. Either through overrides as you've done or through dedupe tools or by clearing those packages out of your lock and reinstalling. There are probably some other ways to handle it as well. You'll want to use a bundle analyzer (ie webpack analyzer plugin) to make sure you only have one copy of each package in your bundled code as well. I'm glad the issue is resolved if you manage the version of @react-aria/interactions. Just a heads up that there was a bug in version 3.22.3, so 3.22.4 is now out. |
@elianarlivingston i believe your issue is of a different topic. Please feel free to open a discussion after searching through our existing Issues and Discussions as this topic has come up before in various contexts. |
I tested To me, this should be the simplest solution. Thank you for your other suggestion, I used |
@AnYiEE I did some brief digging, it seems to be that the touchEnd event from usePress is happening on the Table's row rather than the span button within, hence causing that touch event to be default prevented. I've reproduced it locally in our own storybook with a native button in a table, but it seems like using a RAC button instead of a native button seems to circumvent this problem |
@LFDanLu Hello, it's been a while. I have fixed You mentioned using the RAC button instead of the native button. Could you please elaborate on that? My project does not directly use |
Sure, from what I remember using a React Aria Components Button instead of a native button in a Table locally in our storybook solved the issue where tapping on the button on a mobile device was causing the row to be selected instead of triggering the button's action. The relevant code causing the As for where to file an issue, the team will be working some usePress refactoring and making event propagation stoppage more consistent throughout the library which may change the behavior you are seeing here. Feel free to file a separate issue against us with a base level reproduction so we can track if our work there might fix it. |
The problem disappeared after calling
Unfortunately, it may be difficult for me to provide a minimal reproducible environment. For me, this issue does not even occur on the development server under |
…nd stop event propagation See the issue here for more details: adobe/react-spectrum#7157
Provide a general summary of the issue here
Since version 3.22.3 of the @react-aria/interactions package, item selection functionality on mobile devices has stopped working correctly. This issue arises when using the headless version of the @react-aria/listbox, which depends on @react-aria/interactions. The problem was not present in version 3.22.2.
🤔 Expected Behavior?
Items should be selectable on mobile devices.
😯 Current Behavior
Selection fails or does not respond on mobile devices.
💁 Possible Solution
Suspected #7026
🔦 Context
No response
🖥️ Steps to Reproduce
Codesandbox
Version
@react-aria/[email protected]
What browsers are you seeing the problem on?
Chrome, Safari, FireFox
If other, please specify.
No response
What operating system are you using?
Mac
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: