From 3ad4b0fb64e0d936cd5e67dc30c5124325e1faa1 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 2 Dec 2019 10:01:08 +0000 Subject: [PATCH] Do not trap Key ContextMenu into composer for keyboard a11y Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/Keyboard.js | 1 + src/components/structures/LoggedInView.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/Keyboard.js b/src/Keyboard.js index f63956777f..453ddab1e2 100644 --- a/src/Keyboard.js +++ b/src/Keyboard.js @@ -78,6 +78,7 @@ export const Key = { CONTROL: "Control", META: "Meta", SHIFT: "Shift", + CONTEXT_MENU: "ContextMenu", LESS_THAN: "<", GREATER_THAN: ">", diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index d071ba1d79..ae71af1a85 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -401,6 +401,11 @@ const LoggedInView = createReactClass({ const isClickShortcut = ev.target !== document.body && (ev.key === Key.SPACE || ev.key === Key.ENTER); + // Do not capture the context menu key to improve keyboard accessibility + if (ev.key === Key.CONTEXT_MENU) { + return; + } + // XXX: Remove after CIDER replaces Slate completely: https://github.com/vector-im/riot-web/issues/11036 // If using Slate, consume the Backspace without first focusing as it causes an implosion if (ev.key === Key.BACKSPACE && !SettingsStore.getValue("useCiderComposer")) {