فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix(ux): prevent transient toast pile-ups while preserving persistent accounting warnings and errors
davoodmehraban89 committed
Oct 30, 2026 at 23:29 UTC
6a403178bff37ef4cb2eeae54a254593b4f47826
1 file changed
+7
src/core/Toast.js
+7
@@ -13,6 +13,8 @@ class ToastManager {
13
this.container = document.createElement('div');
14
this.container.className = 'toast-container';
15
this.container.id = 'toastContainer';
16
+ this.container.setAttribute('aria-live', 'polite');
17
+ this.container.setAttribute('aria-relevant', 'additions');
18
document.body.appendChild(this.container);
19
}
20
return this.container;
@@ -24,6 +26,7 @@ class ToastManager {
26
if (c.parentElement === document.body) document.body.appendChild(c);
27
const el = document.createElement('div');
28
el.className = `toast toast-${type}`;
29
+ el.setAttribute('role', type === 'error' ? 'alert' : 'status');
30
el.innerHTML = `
31
<div class="toast-icon">${ICONS[type]}</div>
32
<div class="toast-content">
@@ -33,6 +36,10 @@ class ToastManager {
36
<button class="toast-close" aria-label="بستن">×</button>`;
37
el.querySelector('.toast-close').onclick = () => el.remove();
38
c.appendChild(el);
39
+ // Cap only transient notices. Never silently discard financial errors or
40
+ // warnings; their container is scrollable so they cannot cover the page.
41
+ const passive = [...c.querySelectorAll('.toast-success, .toast-info')];
42
+ while (passive.length > 3) passive.shift().remove();
43
// Errors stay visible until dismissed so users can read and report them.
44
if (type !== 'error') setTimeout(() => {
45
if (!el.isConnected) return;