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);
}
};

View File

@@ -232,7 +232,7 @@ export default class PictureInPictureDragger extends React.Component<IProps> {
this.mouseHeld = false;
// Delaying this to the next event loop tick is necessary for click
// event cancellation to work
setImmediate(() => (this.moving = false));
setTimeout(() => (this.moving = false));
this.snap(true);
};