Skip to content
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 always disables user-select #6226

Open
Pagebakers opened this issue Apr 18, 2024 · 3 comments
Open

useLongPress always disables user-select #6226

Pagebakers opened this issue Apr 18, 2024 · 3 comments

Comments

@Pagebakers
Copy link

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

@reidbarber reidbarber added the enhancement New feature or request label Apr 18, 2024
@reidbarber
Copy link
Member

Seems like a reasonable addition, but we'll have to test how this behaves on touch devices.

@devongovett
Copy link
Member

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.

@reidbarber reidbarber removed the enhancement New feature or request label Apr 22, 2024
@Pagebakers
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants