-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
useLongPress onLongPressEnd fires while still pressed #7044
Comments
Thanks for the issue, this is working as intended.
You just want |
@snowystinger
If |
Thanks for explaining. I'd have thought you could do something like this https://codesandbox.io/p/sandbox/n4gtyw, however, it appears that the usePress is fired as well. We'll need to look into it. Edit: because of this line looks like
We'll need to be careful if we decide to change this, it could be considered a breaking change. |
Gotcha thanks for the response. That's probably the route that I'll go for now. |
Provide a general summary of the issue here
The
onLongPressEnd
event fires almost immediately after theonLongPressStart
event. You can experience the issue in the current version of the documentation: https://react-spectrum.adobe.com/react-aria/useLongPress.html🤔 Expected Behavior?
onLongPressEnd should not fire until mouse up or press end
😯 Current Behavior
When clicking and holding on the
Activate
button at the bottom of the page, all 3 longPress events firehttps://react-spectrum.adobe.com/react-aria/useLongPress.html
💁 Possible Solution
It looks like onLongPress passes through to onPress, so I'm assuming the lower-level handler is firing early.
🔦 Context
I'm using a long press handler in a video player that pauses the video on long press and resumes the video on long press end. Currently the video will pause momentarily and then resume playing.
🖥️ Steps to Reproduce
Reproducible in the docs: https://react-spectrum.adobe.com/react-aria/useLongPress.html
Press and hold on the Activate button and it will log all 3 events
Version
"react-aria": "^3.34.3"
What browsers are you seeing the problem on?
Chrome, Safari
If other, please specify.
Arc
What operating system are you using?
Mac OS
🧢 Your Company/Team
3rd party
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: