Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix: prevent dialogs from closing when clicking overlay background

esengine7ef6598f57c4
diff --git a/editor/src/launcher/NewProjectDialog.ts b/editor/src/launcher/NewProjectDialog.ts
index 7281434a5..cae8f768f 100644
--- a/editor/src/launcher/NewProjectDialog.ts
+++ b/editor/src/launcher/NewProjectDialog.ts
@@ -119,13 +119,6 @@ export class NewProjectDialog {
});
});
- // Overlay click to close
- this.overlay_.addEventListener('click', (e) => {
- if (e.target === this.overlay_) {
- this.options_.onClose();
- }
- });
-
// Escape key to close
const keyHandler = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
diff --git a/editor/src/panels/AddComponentPopup.ts b/editor/src/panels/AddComponentPopup.ts
index 45a82023d..07b140cde 100644
--- a/editor/src/panels/AddComponentPopup.ts
+++ b/editor/src/panels/AddComponentPopup.ts
@@ -212,12 +212,6 @@ export function showAddComponentPopup(
overlay.remove();
};
- overlay.addEventListener('click', (e) => {
- if (e.target === overlay) {
- close();
- }
- });
-
const popup = new AddComponentPopup(container, {
existingComponents,
onSelect,
diff --git a/editor/src/ui/dialog/Dialog.ts b/editor/src/ui/dialog/Dialog.ts
index ece2122f0..93a889ca9 100644
--- a/editor/src/ui/dialog/Dialog.ts
+++ b/editor/src/ui/dialog/Dialog.ts
@@ -16,7 +16,7 @@ export class Dialog {
constructor(options: DialogOptions) {
this.options_ = {
width: 480,
- closeOnOverlay: true,
+ closeOnOverlay: false,
closeOnEscape: true,
showCloseButton: true,
...options,