From 6bb64832efcf78d95ac1752776b9a592014c4a6a Mon Sep 17 00:00:00 2001 From: r-zakarya <82443831+r-zakarya@users.noreply.github.com> Date: Sat, 1 Aug 2026 17:35:04 +0100 Subject: [PATCH] fix(editor): guard the second Esc path against the busy overlay too There are two Escape handlers: a capture-phase one for the editor and the global one-surface-per-keystroke chain. Only the first was guarded, so export - which reaches the editor through the global chain - still popped the discard-confirm under the overlay. --- TEST_SCENARIOS.md | 1 + js/app.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/TEST_SCENARIOS.md b/TEST_SCENARIOS.md index 1e8baea..9835d8c 100644 --- a/TEST_SCENARIOS.md +++ b/TEST_SCENARIOS.md @@ -167,6 +167,7 @@ plus bas. - **ATTENDU** : rien ne se passe. Pas de modale « Discard unsaved changes? ». Elle redevient possible une fois l'overlay parti. - **Historique** : la modale s'ouvrait bel et bien, mais **sous** l'overlay (`z-index 200`) — visible en flou, à demi cliquable. Deux problèmes en un : l'affichage, et surtout le fait d'arbitrer une fermeture d'éditeur pendant qu'une opération écrit sur la même entrée. Garde `isBusy()` posé dans la chaîne Esc de l'éditeur, avec les autres priorités (palette, Settings, modales). - **Non-régression** : le clic extérieur ne ferme déjà pas l'éditeur pendant l'attente — `#busyOverlay` est dans la liste blanche, et il couvre l'écran de toute façon. +- **Tester les DEUX déclencheurs** : *Sync now* **et** *Export*. Il y a **deux** gestionnaires `Esc` distincts — celui en phase de capture dédié à l'éditeur, et la chaîne globale « une surface par frappe » (confirm → palette → change-master → cheatsheet → … → éditeur). Le premier correctif n'en couvrait qu'un, et l'export passait par l'autre : le bug semblait persister alors qu'il avait été corrigé sur le chemin du sync. ### B14 · dialogues natifs ouverts par un clic programmatique - **ACTION** : `A` ouverte + **dirty** → (a) Settings → *Import vault* ; (b) télécharger une pièce jointe (fallback web) ; (c) *Upload icon* ; (d) joindre un fichier. diff --git a/js/app.js b/js/app.js index 1bdc6be..a088d17 100644 --- a/js/app.js +++ b/js/app.js @@ -8139,6 +8139,12 @@ async function init() { e.preventDefault(); openCheatsheet(); } else if (e.key === 'Escape') { + // A blocking operation owns the screen (export, sync, rotation): + // the busy overlay is above every surface listed below, so nothing + // here is actually reachable — and the editor's discard-confirm + // would open invisible underneath it. Second Esc path; the + // capture-phase one for the editor carries the same guard. + if (isBusy()) return; // Close in priority order: confirm first (most modal-y), then the // palette — it OPENS OVER the info modals (Ctrl+K on top of the // cheatsheet), so it must close before them. ONE surface per