fix(reactions): Prevent accidental reaction toggle when long pressing#2368
Conversation
22b4eb0 to
ff1fecf
Compare
When users long press on a reaction to see "who reacted", they would sometimes accidentally toggle the reaction if they released their finger before the context menu threshold (~0.5s) was reached. The issue was that the ReactionsView (UICollectionView) handles taps via didSelectItemAt independently of the table view's context menu system. When a long press didn't reach the context menu threshold, the touch was interpreted as a tap, triggering an unwanted reaction toggle. This fix tracks touch duration and only triggers reaction toggle for quick taps (≤ 0.25s). Longer touches are ignored since they indicate the user intended to long press to view the reactions summary. Signed-off-by: Florian Ludwig <florian.ludwig@uninow.de>
ff1fecf to
bcea537
Compare
|
Hi @luflow :) Thank you for this PR! |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
Problem
When long pressing on a reaction bubble to see "who reacted", users would sometimes accidentally toggle the reaction (add/remove it) if they released their finger before the context menu threshold (~0.5s) was reached.
Root Cause
The
ReactionsView(UICollectionView) handles taps viadidSelectItemAtindependently of the table view's context menu system. When a long press didn't quite reach the context menu threshold, the touch was interpreted as a tap, triggering an unwanted reaction toggle.Solution
Track the touch duration in
ReactionsView:touchesBeganrecords the start timetouchesCancelledclears itdidSelectItemAtchecks the duration:This threshold (0.25s) provides a buffer below the context menu's ~0.5s threshold while still allowing normal quick taps to work.
Test plan