gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmain4099e64aMerge branch 'font-segoe-ui' into mainAtlasmain/tests/taps-audit.mjs

3.0 KB

  1. // tests/taps-audit.mjs — the in-page audit of mission 006: which tap targets are < 44 px and what is wider than the viewport.
  2. // AUDIT is a JS expression (a string) for page.evaluate; it returns { w, sw, taps: [{sel, w, h, text}], wide: [{sel, r}], inputs: [{sel, px}] }.
  3. // A tap target = a visible link, button, summary, select, textarea, text-like input, checkbox / radio (measured by the control or its label,
  4. // the bigger one), [role=button|tab|menuitem]. A link inside running text (its parent is a p / li / td / label / dd with other text) is
  5. // measured too but flagged `inline` — it is listed separately, because WCAG 2.5.8 exempts inline links in a sentence.
  6. export const AUDIT = `(() => {
  7. const vis = (el) => { const cs = getComputedStyle(el); if (cs.display === 'none' || cs.visibility === 'hidden' || cs.pointerEvents === 'none') return false; if (el.closest('.visually-hidden')) return false; const r = el.getBoundingClientRect(); return r.width > 0 && r.height > 0; };
  8. const sel = (el) => { let s = el.tagName.toLowerCase(); if (el.id) s += '#' + el.id; else if (el.className && typeof el.className === 'string') s += '.' + el.className.trim().split(/\\s+/).slice(0, 2).join('.'); const p = el.parentElement; if (p) s = p.tagName.toLowerCase() + (p.className && typeof p.className === 'string' ? '.' + p.className.trim().split(/\\s+/)[0] : '') + ' > ' + s; return s; };
  9. const els = [...document.querySelectorAll('a[href], button, summary, select, textarea, input:not([type=hidden]), [role=button], [role=tab], [role=menuitem], label.choose')];
  10. const taps = [], inputs = [];
  11. for (const el of els) {
  12. if (!vis(el)) continue;
  13. let r = el.getBoundingClientRect();
  14. if (el.matches('input[type=checkbox], input[type=radio]') && el.labels && el.labels[0]) { const l = el.labels[0].getBoundingClientRect(); if (l.width * l.height > r.width * r.height) r = l; }
  15. const inline = el.matches('a') && !!el.parentElement && /^(P|LI|TD|DD|LABEL|SMALL|SPAN|H[1-6]|DIV)$/.test(el.parentElement.tagName) && (el.parentElement.textContent.trim().length > el.textContent.trim().length + 2) && getComputedStyle(el).display === 'inline';
  16. const w = Math.round(r.width * 10) / 10, h = Math.round(r.height * 10) / 10;
  17. if (w < 43.99 || h < 43.99) taps.push({ sel: sel(el), w, h, inline, text: (el.getAttribute('aria-label') || el.textContent || el.value || '').trim().slice(0, 24) });
  18. if (el.matches('input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=file]), select, textarea')) { const px = parseFloat(getComputedStyle(el).fontSize); if (px < 16) inputs.push({ sel: sel(el), px }); }
  19. }
  20. const wide = [];
  21. for (const el of document.body.querySelectorAll('*')) {
  22. if (!vis(el) || el.closest('pre, code-editor, md-editor, .scroll, table')) continue;
  23. const r = el.getBoundingClientRect();
  24. if (r.right > window.innerWidth + 0.5) wide.push({ sel: sel(el), r: Math.round(r.right) });
  25. }
  26. return { w: window.innerWidth, sw: document.documentElement.scrollWidth, n: els.length, taps, wide: wide.slice(0, 20), nwide: wide.length, inputs };
  27. })()`;

Branches

Latest commits

  • 4099e64aMerge branch 'font-segoe-ui' into mainAtlas
  • e14fb795|||PR Theme font: Segoe UI first (his choice 2026-11-19)Atlas
  • 44071d2cMerge branch 'hl-standard-5' into mainAtlas
  • 5ea64202|||PR Gate: count the new-tab check's console errors tooAtlas
  • 2752ceddMerge branch 'hl-standard-4' into mainAtlas
  • ac552b81|||PR Gate: keyboard (Tab/Enter/Space) and Back/Forward/reload/new-tab checks (HL-STANDARD F5, F21)Atlas
  • 8cddcaa9Merge branch 'hl-standard-2' into mainAtlas
  • 2b480a64|||PR Type the route parameter of main-menu build (HL-STANDARD L10)Atlas
  • ab54a39dMerge branch 'hl-standard' into mainAtlas
  • 04d36fcf|||PR Type function parameters and drop unneeded let (HL-STANDARD L2, L10)Atlas
  • 220c8fa4Merge branch 'readme-audit' into mainAtlas
  • b78fb85a|||PR README matches the codemre
  • 9f351699Preserve comments and nest supported selectors without changing rendered outputmre
  • 97110ad9WIP: nest accepted layout selectors; stopped at startup parse failuremre
  • ce4a0baeKeep caller slot styles whole so minimal shell apps startmre
  • 12cd3992Re-vendor complete Hybriel plugins and runtime to day44mre
  • b05c20feBackup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
  • 8d9ed0b8Re-vendor complete Hybriel plugins and runtime to day39mre
  • ebd00b6cNest caller slot styles in three-panemre
  • 009991efNest caller slot styles in list-firstmre