react-spectrum
react-spectrum copied to clipboard
useLongPress always disables user-select
Provide a general summary of the issue here
I'm using useLongPress with in a custom context menu component to support touch devices. Now when the longPressProps are passed to the container element, text can no longer be selected. usePress has an option to enable it, but this is not accepted by the useLongPress hook.
๐ค Expected Behavior?
Allow to set allowTextSelectionOnPress on the useLongPress hook
๐ฏ Current Behavior
allowTextSelectionOnPress not supported
๐ Possible Solution
No response
๐ฆ Context
No response
๐ฅ๏ธ Steps to Reproduce
Reproduction: https://storybook.saas-ui.dev/?path=/story/components-overlay-contextmenu--basic
Code: https://github.com/saas-js/saas-ui/blob/main/packages/saas-ui-core/src/menu/context-menu.tsx#L55
Version
"@react-aria/interactions": "^3.21.1",
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
Mac OS
๐งข Your Company/Team
No response
๐ท Tracking Issue
No response
Seems like a reasonable addition, but we'll have to test how this behaves on touch devices.
These gestures directly conflict though. Long press is the gesture to select text on iOS. So if you're doing a different action on long press, I'm not sure it makes sense to also select text. You probably want either one or the other.
That makes sense, the idea is also to only allow selection on mouse input devices. But perhaps there is a better way to check the device type in the touch event?