From f3776f89448b4bbec3020281fc95c3976ada824f Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 22 Dec 2021 10:53:17 +0000 Subject: [PATCH] Prevent keyboard propagation out of context menus (#7437) --- src/components/structures/ContextMenu.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/structures/ContextMenu.tsx b/src/components/structures/ContextMenu.tsx index 95a414e1a1b..c2ebbdc784d 100644 --- a/src/components/structures/ContextMenu.tsx +++ b/src/components/structures/ContextMenu.tsx @@ -188,6 +188,8 @@ export default class ContextMenu extends React.PureComponent { // We now only handle closing the ContextMenu in this keyDown handler. // All of the item/option navigation is delegated to RovingTabIndex. private onKeyDown = (ev: React.KeyboardEvent) => { + ev.stopPropagation(); // prevent keyboard propagating out of the context menu, we're focus-locked + // If someone is managing their own focus, we will only exit for them with Escape. // They are probably using props.focusLock along with this option as well. if (!this.props.managed) {