layouts
All repositories: gitoria
3.0 KB
// tests/taps-audit.mjs — the in-page audit of mission 006: which tap targets are < 44 px and what is wider than the viewport.// 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}] }.// A tap target = a visible link, button, summary, select, textarea, text-like input, checkbox / radio (measured by the control or its label,// 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// measured too but flagged `inline` — it is listed separately, because WCAG 2.5.8 exempts inline links in a sentence.export const AUDIT = `(() => {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; };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; };const els = [...document.querySelectorAll('a[href], button, summary, select, textarea, input:not([type=hidden]), [role=button], [role=tab], [role=menuitem], label.choose')];const taps = [], inputs = [];for (const el of els) {if (!vis(el)) continue;let r = el.getBoundingClientRect();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; }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';const w = Math.round(r.width * 10) / 10, h = Math.round(r.height * 10) / 10;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) });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 }); }}const wide = [];for (const el of document.body.querySelectorAll('*')) {if (!vis(el) || el.closest('pre, code-editor, md-editor, .scroll, table')) continue;const r = el.getBoundingClientRect();if (r.right > window.innerWidth + 0.5) wide.push({ sel: sel(el), r: Math.round(r.right) });}return { w: window.innerWidth, sw: document.documentElement.scrollWidth, n: els.length, taps, wide: wide.slice(0, 20), nwide: wide.length, inputs };})()`;
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