From ccad317f638bb5e827109e00736f6d8228447f33 Mon Sep 17 00:00:00 2001 From: Ian Flanigan Date: Sun, 11 Oct 2020 17:53:33 +0200 Subject: [PATCH] Fix bug where the alert dialog would not close (#32) Micromodal maintains a reference to the current open dialog in this.modal. If one dialog is open while opening another, Micromodal can get confused and maintain a reference to the wrong one. One of the problems is that the close action is not instantaneous, so even closing one dialog and opening another immediately after can cause the problem. This change adds a small delay before opening the alert dialog to work around the problem. --- js/ui/apple2.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/ui/apple2.js b/js/ui/apple2.js index a46d852..b67f92b 100644 --- a/js/ui/apple2.js +++ b/js/ui/apple2.js @@ -233,6 +233,7 @@ export function doSave() { var name = document.querySelector('#save_name').value; saveLocalStorage(_currentDrive, name); MicroModal.close('save-modal'); + window.setTimeout(() => openAlert('Saved'), 0); } export function doDelete(name) { @@ -508,8 +509,6 @@ function saveLocalStorage(drive, name) { window.localStorage.diskIndex = JSON.stringify(diskIndex); - openAlert('Saved'); - driveLights.label(drive, name); driveLights.dirty(drive, false); updateLocalStorage();