signal-desktop/patches/react-contextmenu+2.11.0.patch

37 lines
1.5 KiB
Diff
Raw Normal View History

2019-11-07 21:36:16 +00:00
diff --git a/node_modules/react-contextmenu/modules/ContextMenu.js b/node_modules/react-contextmenu/modules/ContextMenu.js
2021-09-16 21:51:57 +00:00
index 622a1f9..9fc87ea 100644
2019-11-07 21:36:16 +00:00
--- a/node_modules/react-contextmenu/modules/ContextMenu.js
+++ b/node_modules/react-contextmenu/modules/ContextMenu.js
@@ -226,6 +226,9 @@ var ContextMenu = function (_AbstractMenu) {
2021-09-16 21:51:57 +00:00
2019-11-07 21:36:16 +00:00
if (this.state.isVisible) {
var wrapper = window.requestAnimationFrame || setTimeout;
+ if (!this.previousFocus) {
+ this.previousFocus = document.activeElement;
+ }
2021-09-16 21:51:57 +00:00
2019-11-07 21:36:16 +00:00
wrapper(function () {
var _state = _this2.state,
2021-09-16 21:51:57 +00:00
@@ -241,13 +244,21 @@ var ContextMenu = function (_AbstractMenu) {
_this2.menu.style.top = top + 'px';
2019-11-07 21:36:16 +00:00
_this2.menu.style.left = left + 'px';
_this2.menu.style.opacity = 1;
2021-09-16 21:51:57 +00:00
+ _this2.menu.style.visibility = 'visible';
2019-11-07 21:36:16 +00:00
_this2.menu.style.pointerEvents = 'auto';
+
+ _this2.menu.focus();
});
});
} else {
if (!this.menu) return;
this.menu.style.opacity = 0;
this.menu.style.pointerEvents = 'none';
+
+ if (this.previousFocus && this.previousFocus.focus) {
+ this.previousFocus.focus();
+ this.previousFocus = null;
+ }
}
}
}, {