From 60e0ed2af6ea57ae12f62c277738eb5b37ce872c Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 14 Oct 2021 09:34:46 +0100 Subject: [PATCH] Avoid conflicts with native browser cmd-ctrl type shortcuts Fixes #3190 --- .../@node-red/editor-client/src/js/ui/keyboard.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/keyboard.js b/packages/node_modules/@node-red/editor-client/src/js/ui/keyboard.js index 7a38a290d..5c1be9c2b 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/keyboard.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/keyboard.js @@ -243,7 +243,13 @@ RED.keyboard = (function() { function resolveKeyEvent(evt) { var slot = partialState||handlers; - if (evt.ctrlKey || evt.metaKey) { + // We cheat with MacOS CMD key and consider it the same as Ctrl. + // That means we don't have to have separate keymaps for different OS. + // It mostly works. + // One exception is shortcuts that include both Cmd and Ctrl. We don't + // support them - but we need to make sure we don't block browser-specific + // shortcuts (such as Cmd-Ctrl-F for fullscreen). + if ((evt.ctrlKey || evt.metaKey) && (evt.ctrlKey !== evt.metaKey)) { slot = slot.ctrl; } if (slot && evt.shiftKey) {