فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix(a11y): focus the first visible financial input rather than hidden radio or ID fields
davoodmehraban89 committed
Oct 31, 2026 at 00:11 UTC
4b95b97c82cee5afc1125a9090b6c1d1a572951d
1 file changed
+6
-3
src/core/Modal.js
+6
-3
@@ -118,9 +118,12 @@ class ModalManager {
118
}
119
queueMicrotask(() => {
120
if (this.stack[this.stack.length - 1] !== modal || !modal.card.isConnected) return;
121
- const focusTarget = modal.card.querySelector('[autofocus]') ||
122
- modal.card.querySelector('input:not([disabled]), select:not([disabled]), textarea:not([disabled])') ||
123
- this._focusable(modal.card)[0] || modal.card;
121
+ // Prefer a VISIBLE input. A hidden radio/record-ID input can be the
122
+ // first field in financial forms; focusing it leaves the dialog unfocused.
123
+ const focusables = this._focusable(modal.card);
124
+ const focusTarget = focusables.find(el => el.hasAttribute('autofocus')) ||
125
+ focusables.find(el => el.matches('input, select, textarea')) ||
126
+ focusables[0] || modal.card;
127
focusTarget.focus({ preventScroll: true });
128
});
129
return modal;