From d792bc542405f857cf147ca8d3a40cd2bea24bca Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Mon, 3 May 2021 10:00:14 -0700 Subject: [PATCH] [fix] Pressable onPress is called for ctrl+click on Windows Pressing ctrl+click on a link opens a new tab in Windows. On macOS it opens the context menu but doesn't dispatch a 'click' event. On other element types both OS dispatch a 'click'. Removing the condition related to 'ctrlKey' produces the desired behavior across OS. Fix #2000 --- .../src/modules/usePressEvents/PressResponder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-web/src/modules/usePressEvents/PressResponder.js b/packages/react-native-web/src/modules/usePressEvents/PressResponder.js index 1109e40d..5a181521 100644 --- a/packages/react-native-web/src/modules/usePressEvents/PressResponder.js +++ b/packages/react-native-web/src/modules/usePressEvents/PressResponder.js @@ -392,7 +392,7 @@ export default class PressResponder { event.stopPropagation(); if (this._longPressDispatched || this._selectionTerminated) { event.preventDefault(); - } else if (onPress != null && event.ctrlKey === false && event.altKey === false) { + } else if (onPress != null && event.altKey === false) { onPress(event); } } else {