Replace setImmediate with setTimeout (#12614)

This commit is contained in:
Michael Telatynski
2024-06-13 15:15:59 +01:00
committed by GitHub
parent 21ae29c002
commit 8b4e3e6647
21 changed files with 46 additions and 39 deletions

View File

@@ -170,7 +170,7 @@ export default class ContextMenu extends React.PureComponent<React.PropsWithChil
// XXX: This isn't pretty but the only way to allow opening a different context menu on right click whilst
// a context menu and its click-guard are up without completely rewriting how the context menus work.
setImmediate(() => {
setTimeout(() => {
const clickEvent = new MouseEvent("contextmenu", {
clientX: x,
clientY: y,
@@ -180,7 +180,7 @@ export default class ContextMenu extends React.PureComponent<React.PropsWithChil
relatedTarget: null,
});
document.elementFromPoint(x, y)?.dispatchEvent(clickEvent);
});
}, 0);
}
};