adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
13.04k stars 1.13k forks source link

useLongPress should be cancelled on multiple touches #5934

Open aeharding opened 8 months ago

aeharding commented 8 months ago

Provide a general summary of the feature here

Hi there!

I just received an accessibility issue from a user (see: https://github.com/aeharding/voyager/issues/1254).

3-finger double tap cause [long press menu] to open. This is commonly used as an accessibility shortcut. I use it for full screen zoom. Ii can't do it with [App] because it causes the [long press menu] to open in waiting to the zoom.

Essentially, the native iOS feature is conflicting with long press, because long press does not cancel when multiple touches are detected.

๐Ÿค” Expected Behavior?

Long press should cancel when multiple touches are detected - at very least, as an option.

This is the standard behavior for native iOS apps (for example, the Mail app).

๐Ÿ˜ฏ Current Behavior

Holding screen with two fingers, or pressing one finger and then another before the LONG_PRESS_THRESHOLD, causes the long press callback to be triggered.

๐Ÿ’ Possible Solution

New option: LongPressProps["cancelOnTouches"]?: boolean

๐Ÿ”ฆ Context

Please see accessibility concern from user, where they cannot use the native iOS zoom function with 3-finger tap because it conflicts with useLongPress.

https://github.com/aeharding/voyager/issues/1254

๐Ÿ’ป Examples

No response

๐Ÿงข Your Company/Team

Voyager for Lemmy

๐Ÿ•ท Tracking Issue

https://github.com/aeharding/voyager/issues/1254

reidbarber commented 8 months ago

Cancelling the long press seem like the correct behavior in this case, and matches native iOS and Android behavior.