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

qa(a11y): inventory visible form fields and report missing programmatic labels across routes and nested modals

davoodmehraban89 committed Oct 30, 2026 at 23:33 UTC 67bc7a8a7fb069bcb680b8051385c7ef035c9b3e
1 file changed +36
tests/windows-vm-ui-interaction-audit-browser.js
+36
@@ -14,6 +14,7 @@
14 const clicks = [];
15 const skipped = [];
16 const all = new Map();
17 + const fields = new Map();
18 const target = () => document.getElementById('pageContent');
19 const isVisible = el => {
20 const style = window.getComputedStyle(el);
@@ -35,8 +36,34 @@
36 const clickables = (root) => [...root.querySelectorAll(
37 'button, a, [role="button"], input[type="button"], input[type="submit"], [onclick]'
38 )].filter(isVisible);
39 + function auditFields(root, route, section) {
40 + if (!root) return;
41 + for (const field of root.querySelectorAll(
42 + 'input:not([type="hidden"]), select, textarea'
43 + )) {
44 + if (!isVisible(field)) continue;
45 + const labels=field.labels ? [...field.labels] : [];
46 + const explicit=!!field.getAttribute('aria-label') ||
47 + !!field.getAttribute('aria-labelledby') ||
48 + !!field.closest('label') || labels.length > 0;
49 + const id=field.id||'';
50 + const key=[route,section,field.tagName.toLowerCase(),id,
51 + field.getAttribute('name')||'',field.getAttribute('type')||''].join('|');
52 + if (fields.has(key)) continue;
53 + fields.set(key,{
54 + route,section,id,tag:field.tagName.toLowerCase(),
55 + type:field.getAttribute('type')||'',
56 + label:labels.map(x=>x.textContent.trim().slice(0,75)).join(' / ') ||
57 + field.getAttribute('aria-label') || '',
58 + programmaticLabel:explicit,
59 + placeholderOnly:!explicit && !!field.getAttribute('placeholder'),
60 + status:explicit?'programmatic-label-found':'needs-accessibility-review'
61 + });
62 + }
63 + }
64 function inventory(route, section) {
65 const controls = clickables(target());
66 + auditFields(target(),route,section);
67 const records = [];
68 for (const el of controls) {
69 const k=sig(el,route,section);
@@ -272,6 +299,7 @@
299 failures.push({route,section:ctx.section,kind:'modal-a11y-missing',
300 handler:action.slice(0,170)});
301 }
302 + auditFields(overlay,route,ctx.section+'/modal');
303 const nested=clickables(overlay);
304 const modalControls=nested.map(x=>({
305 route,section:ctx.section+'/modal',tag:x.tagName.toLowerCase(),
@@ -331,10 +359,18 @@
359 skippedCount:rows.filter(x=>x.status==='not-clicked').length,
360 brokenHandlerCount:rows.filter(x=>x.status==='broken-handler').length,
361 accessibilityNameGaps:rows.filter(x=>!x.hasAccessibleName).length,
362 + fieldsInspected:fields.size,
363 + fieldsMissingProgrammaticLabel:[...fields.values()].filter(x=>!x.programmaticLabel).length,
364 + fieldsWithoutLabels:[...fields.values()].filter(x=>!x.programmaticLabel).slice(0,100),
365 + fieldCoverageByRoute:Object.fromEntries(routes.map(r=>[r,{
366 + inspected:[...fields.values()].filter(x=>x.route===r).length,
367 + missingProgrammaticLabel:[...fields.values()].filter(x=>x.route===r && !x.programmaticLabel).length
368 + }])),
369 problems:failures,
370 byRoute,
371 controls:rows,
372 clickEvidence:clicks,
373 + fieldEvidence:[...fields.values()],
374 financialActionsNotBulkClicked:true,
375 customerDataUsed:false,
376 everyActionVerified:false