فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

fix(a11y): verify real and ambiguous modal label associations

davoodmehraban89 committed Oct 31, 2026 at 00:16 UTC ad1411b3b73c589930b98233a8ed764e84b48db5
1 file changed +27
tests/windows-vm-ui-interaction-audit-browser.js
+27
@@ -317,7 +317,27 @@
317 if (document.activeElement!==modalTrigger) {
318 throw Error('Closing visible-input dialog did not restore keyboard focus');
319 }
320 + // Real DOM probe: preserve ambiguous groups and explicit accessible names.
321 + const labelsProbe=FINORA.Modal.open({title:'Q01 Synthetic form labels',body:
322 + '<div class="form-group"><label class="form-label">نام آزمایشی</label><input id="q01SingleField"></div>' +
323 + '<div class="form-group"><label class="form-label">گروه چندفیلدی</label><input id="q01MultiOne"><input id="q01MultiTwo"></div>' +
324 + '<div class="form-group"><label class="form-label" for="q01ExistingField">برچسب صریح</label><input id="q01ExistingField"></div>',
325 + footer:'<button class="btn" onclick="FINORA.Modal.close()">بستن</button>',size:'sm'});
326 + await wait(25);
327 + const namedField=labelsProbe.card.querySelector('#q01SingleField');
328 + const multiOne=labelsProbe.card.querySelector('#q01MultiOne');
329 + const existingField=labelsProbe.card.querySelector('#q01ExistingField');
330 + if (namedField.labels?.length!==1 ||
331 + namedField.labels[0].textContent.trim()!=='نام آزمایشی' ||
332 + multiOne.labels?.length || existingField.labels?.length!==1 ||
333 + existingField.labels[0].getAttribute('for')!=='q01ExistingField') {
334 + throw Error('Modal form labels were missing, ambiguous, or overwrote explicit names');
335 + }
336 + namedField.labels[0].click(); await wait(15);
337 + if (document.activeElement!==namedField) throw Error('Linked modal field label did not focus its field');
338 + FINORA.Modal.close();
339 const modalKeyboard={roleAndLabel:true,nestedDialogIsolation:true,
340 + modalFormLabelsLinked:true,
341 confirmationTextEscaped:true,visibleInputAutoFocused:true,
342 escapeClosesWithoutConfirm:true,focusReturnsToTrigger:true,
343 enterOnFocusedCancelDoesNotSave:true,enterOnInputDoesNotSubmit:true,
@@ -416,6 +436,13 @@
436 failures.push({route,section:ctx.section,kind:'modal-a11y-missing',
437 handler:action.slice(0,170)});
438 }
439 + if (route==='expenses' && action.includes('openExpenseModal()')) {
440 + const real=dialog?.querySelector('#expCategory');
441 + if (!real || real.labels?.length!==1 ||
442 + !real.labels[0].textContent.includes('سرفصل')) {
443 + failures.push({route,section:ctx.section,kind:'expense-category-label-missing'});
444 + }
445 + }
446 auditFields(overlay,route,ctx.section+'/modal');
447 const nested=clickables(overlay);
448 const modalControls=nested.map(x=>({