gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitbadc1879badc1879md-editor.hl: verbatim copy of components f3-mdvalue (an older text handed back is kept)mrebadc1879/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

  • badc1879md-editor.hl: verbatim copy of components f3-mdvalue (an older text handed back is kept)mre
  • 867a8375md-editor.hl: verbatim copy of components f3-mdvalue (an outside value change is shown by the editor)mre
  • 5d8d2c67tests: wait for hydration before real clicks after a navigation (H2)mre
  • 99db79f0re-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
  • 30353f60tests: e2e-md-showcase Chrome range from LAYOUTS_GATE_CHROME_MD, default unchangedmre
  • 16a7878cre-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
  • 6af559e8docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre
  • 5599cf56deploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
  • 0bcc6294Mission 011: e2e-197, brief, report, LOGmre
  • 137303c5MainMenu marks the current page from the route (hybriel#197, server-rendered); current prop/item.current stay as fallback; tracker demo drops current; gate: SSR marker; docsmre
  • 9325b403Re-vendor Hybriel to master 7f13a82f (hl:web batch 2: #190 #193 #197 #194 named regions); plugins whole, bin/hybriel static build (git-ignored)mre
  • b31dc74dusage: calendar (theme 76f99f6-era ContentFirst, user menu, ☰ menu) and tracker (theme 76f99f6, modal + pagination current, own current marker until hybriel#197) rowsmre
  • 8a3d5d40Mission 010: brief, report, LOG, STATUSmre
  • a56abf1fSync components to components.hybriel 3794c59 (MdEditor real-key fixes); showcase real-key check on the md-editor pagemre
  • 76f99f64E2E in lisbeth's Chrome for the menu's current page (mission 009): tests/e2e-menu-current.mjs, reportmre
  • 159b1d53MainMenu/Sidebar: current page marked beyond colour, count badge, item current flag; gate 300/0 (mission 009)mre
  • 0573eed3usage: notes + tickets on MdEditor (md-editor.js retired), gitoria on theme dbe3de7, tracker theme oldermre
  • 78478f6eSync showcase to components.hybriel 1442e58: pick-mode page, comments attach, md-editor rows/files off; gates 285/0mre
  • dbe3de79Display bugs from a real Chrome walk (mission 007): Settings page and in-shell doc reader instead of raw .md links, closed phone search hidden whatever a page says, /elements form rules scoped, three-pane danger contrast; display audit gate (132 -> 244 checks), walk + Settings e2e toolsmre
  • 1875a051Theme: 44 px tap targets mobile first (layoutTap), 16 px fields, desktop denser only in @media 60rem; 390 px tap audit + gate checks (mission 006)mre