Fixes contextmenu hover glitch

This commit is contained in:
Josh Perez 2021-09-16 17:51:57 -04:00 committed by GitHub
parent 9ff1c1e50d
commit 04aad09590
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -1,20 +1,22 @@
diff --git a/node_modules/react-contextmenu/modules/ContextMenu.js b/node_modules/react-contextmenu/modules/ContextMenu.js
index 622a1f9..61c8e70 100644
index 622a1f9..9fc87ea 100644
--- a/node_modules/react-contextmenu/modules/ContextMenu.js
+++ b/node_modules/react-contextmenu/modules/ContextMenu.js
@@ -226,6 +226,9 @@ var ContextMenu = function (_AbstractMenu) {
if (this.state.isVisible) {
var wrapper = window.requestAnimationFrame || setTimeout;
+ if (!this.previousFocus) {
+ this.previousFocus = document.activeElement;
+ }
wrapper(function () {
var _state = _this2.state,
@@ -242,12 +245,19 @@ var ContextMenu = function (_AbstractMenu) {
@@ -241,13 +244,21 @@ var ContextMenu = function (_AbstractMenu) {
_this2.menu.style.top = top + 'px';
_this2.menu.style.left = left + 'px';
_this2.menu.style.opacity = 1;
+ _this2.menu.style.visibility = 'visible';
_this2.menu.style.pointerEvents = 'auto';
+
+ _this2.menu.focus();