فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix(a01): make financial confirmation callbacks one-shot and reject stale dialog buttons
davoodmehraban89 committed
Oct 31, 2026 at 00:37 UTC
9501e8a8f46e5f6502d6613fde6f65de47e49d07
1 file changed
+11
-1
src/core/Modal.js
+11
-1
@@ -190,8 +190,18 @@ class ModalManager {
190
const confirmButton = footerEl.querySelector('[data-action="confirm"]');
191
cancelButton.textContent = String(cancelText ?? '');
192
confirmButton.textContent = String(confirmText ?? '');
193
- cancelButton.onclick = () => this.close();
193
+ // Financial confirmation must be a one-shot decision. Stale detached
194
+ // buttons and actions on a hidden parent dialog have no authority.
195
+ let settled = false;
196
+ const isActive = () => this.stack[this.stack.length - 1] === modal;
197
+ cancelButton.onclick = () => {
198
+ if (settled || !isActive()) return;
199
+ settled = true;
200
+ this.close();
201
+ };
202
confirmButton.onclick = () => {
203
+ if (settled || !isActive()) return;
204
+ settled = true;
205
this.close();
206
if (onConfirm) onConfirm();
207
};