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

Pressable suppression of contextmenu on Windows #2296

Closed
necolas opened this issue Jun 5, 2022 · 0 comments
Closed

Pressable suppression of contextmenu on Windows #2296

necolas opened this issue Jun 5, 2022 · 0 comments
Labels
project:react-native-web Issue associated with react-native-web
Milestone

Comments

@necolas
Copy link
Owner

necolas commented Jun 5, 2022

The problem

Long-press with a touch on a Pressable does not suppress the contextmenu on Windows. On iOS and Android, the contextmenu is triggered while the pointer is down, after a certain length of time. However, on Windows, the contextmenu is displayed after pointerup (with the same timestamp as pointerup), whether triggered by a mouse right-click or a touch long-press.

How to reproduce

Simplified test case: https://6r9liu.sse.codesandbox.io/pressable (existing Pressable example)

Steps to reproduce:

  1. Open test case on Windows
  2. Use Responsive Design mode in Chrome dev tools and enable touch emulation.
  3. Long press the Pressable and then release the pointer.
  4. The contextmenu will display (with a type of PointerEvent, pointerType of touch, button value of -1, and the same timestamp as pointerup).

Expected behavior

No contextmenu should display if listening to longpress interaction. This can probably be fixed simply by calling preventDefault on all contextmenu events with a button value of -1 and/or pointerType of "touch" when onLongPress is defined.

Environment (include versions). Did this work in previous versions?

  • React Native for Web (version): 0.17 (all)
  • Browser: Browsers on Windows
@necolas necolas modified the milestones: 0.18: StyleSheet, 0.18.x Jun 8, 2022
@necolas necolas added the project:react-native-web Issue associated with react-native-web label Jul 2, 2022
rnike pushed a commit to VeryBuy/react-native-web that referenced this issue Sep 13, 2022
Long-press with a touch on a Pressable does not suppress the contextmenu
on Windows. On iOS and Android, the contextmenu is triggered while the
pointer is down, after a certain length of time. However, on Windows,
the contextmenu is displayed after pointerup (with the same timestamp as
pointerup), whether triggered by a mouse right-click or a touch
long-press.

Fix necolas#2296
Close necolas#2316
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project:react-native-web Issue associated with react-native-web
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant