Merge pull request #3689 from matrix-org/t3chguy/dont_trap_context_menu_keyboard

Do not trap Key ContextMenu into composer for keyboard a11y
This commit is contained in:
Michael Telatynski 2019-12-02 11:37:24 +00:00 committed by GitHub
commit a17df6dd38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -78,6 +78,7 @@ export const Key = {
CONTROL: "Control", CONTROL: "Control",
META: "Meta", META: "Meta",
SHIFT: "Shift", SHIFT: "Shift",
CONTEXT_MENU: "ContextMenu",
LESS_THAN: "<", LESS_THAN: "<",
GREATER_THAN: ">", GREATER_THAN: ">",

View file

@ -401,6 +401,11 @@ const LoggedInView = createReactClass({
const isClickShortcut = ev.target !== document.body && const isClickShortcut = ev.target !== document.body &&
(ev.key === Key.SPACE || ev.key === Key.ENTER); (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 // 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 using Slate, consume the Backspace without first focusing as it causes an implosion
if (ev.key === Key.BACKSPACE && !SettingsStore.getValue("useCiderComposer")) { if (ev.key === Key.BACKSPACE && !SettingsStore.getValue("useCiderComposer")) {