From 56b5f20cf26b23654eca2887da1d254a1eedef84 Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:03:22 -0600 Subject: [PATCH] Fix composer focus when using message menu to reply in narrow widths Co-authored-by: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com> --- patches/react-contextmenu+2.14.0.patch | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/patches/react-contextmenu+2.14.0.patch b/patches/react-contextmenu+2.14.0.patch index 5704c3390fb5..b8588dcee5d6 100644 --- a/patches/react-contextmenu+2.14.0.patch +++ b/patches/react-contextmenu+2.14.0.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/react-contextmenu/modules/ContextMenu.js b/node_modules/react-contextmenu/modules/ContextMenu.js -index 2f88213..d41a53c 100644 +index 2f88213..4cf584a 100644 --- a/node_modules/react-contextmenu/modules/ContextMenu.js +++ b/node_modules/react-contextmenu/modules/ContextMenu.js @@ -81,6 +81,11 @@ var ContextMenu = function (_AbstractMenu) { @@ -35,12 +35,15 @@ index 2f88213..d41a53c 100644 }); }); } else { -@@ -248,6 +259,11 @@ var ContextMenu = function (_AbstractMenu) { +@@ -248,6 +259,14 @@ var ContextMenu = function (_AbstractMenu) { if (!_this2.menu) return; _this2.menu.style.opacity = 0; _this2.menu.style.pointerEvents = 'none'; + -+ if (_this2.previousFocus && _this2.previousFocus.focus) { ++ // Return to the previous focus state when dismissing the menu, unless the ++ // menu option focused another element. This is important for keyboard mode. ++ var isFocusWithinMenu = _this2.menu.contains(document.activeElement); ++ if (isFocusWithinMenu && _this2.previousFocus && _this2.previousFocus.focus) { + _this2.previousFocus.focus(); + _this2.previousFocus = null; + } @@ -48,7 +51,7 @@ index 2f88213..d41a53c 100644 } } diff --git a/node_modules/react-contextmenu/modules/SubMenu.js b/node_modules/react-contextmenu/modules/SubMenu.js -index ad1dc70..4604898 100644 +index ad1dc70..c919be8 100644 --- a/node_modules/react-contextmenu/modules/SubMenu.js +++ b/node_modules/react-contextmenu/modules/SubMenu.js @@ -129,6 +129,7 @@ var SubMenu = function (_AbstractMenu) {