diff --git a/js/app.js b/js/app.js index 9539e39..93fac4c 100644 --- a/js/app.js +++ b/js/app.js @@ -3829,9 +3829,12 @@ async function openSlideOver(id, opts) { // changes would silently drop them — gate on the same confirm dialog // used by close paths. Only fires when the panel is already open AND // we're actually moving to a different target. + // A "switch" = the panel is open on a different target. soState.id !== id + // catches every cross-id case EXCEPT new→new (both ids null), which is + // still a real switch (a dirty unsaved new entry replaced by a fresh one, + // e.g. Ctrl+Shift+A) — so OR that case in explicitly. const switching = $('#slideover').classList.contains('is-open') && - soState && (soState.id !== id) && - !(isNew && soState.id == null && soState.id === id); + soState && (soState.id !== id || (id == null && soState.id == null)); if (switching && state.confirmOnUnsaved && isSoDirty()) { const ok = await confirmDialog({ title: 'Discard unsaved changes?',