gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit40a9e69c40a9e69cMP: report, LOG linemre40a9e69c/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

  • 40a9e69cMP: report, LOG linemre
  • 5b5dbf0fMedia player: the component from components.hybriel dd003e5 (sync-components), the showcase page /components/media-player with a queue, its media files served with ranges (lib/media.hl), theme rules (the seek bar, the queue's current item, the radii), the page in the overview listsmre
  • 9197159fTake components e54f83a: table lines and one-row desktop toolbar in the theme, Table button gates, a table in the md-editor demomre
  • e6322a44UX: report and LOG linemre
  • 58c2da6fUX: nav marker without bars; chat composer is one box (files-upload pick mode, showcase); comments state footer + closer reactions row; modal footer rule only for its own footer; gates for all of itmre
  • 956f107async components.hybriel 4922f9c: 44 px targets in month-view, date-picker, range-picker, pagination, modal, comments; names follow <html lang> (English default), UTC weekday fix; gate: 390 px target checks, 'edited' hit-area padding; comments showcase 'You are' is a labelled group (SY)mre
  • 49940371sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
  • 6f7bd392gate: the phone toolbar is two even rows (E2)mre
  • 3049c082sync components.hybriel 214c318: MdEditor on a phone, two even toolbar rows of 44 px targets, label 15 px, table head 16 px (E2)mre
  • b9a3f85fLOG: MLmre
  • 7979397creport ML-mobilemre
  • 85d2ed25gate: wordingmre
  • 98a311c0gate: 390 px checks for list rows, table word, edited tap target, code in titlesmre
  • 769b99d7theme: table cells keep a word whole, code in a title stays text-sized, 'edited' is a 44 px tap target on the phonemre
  • c36b7595list rows (notes, mail) stack their parts full width: the date no longer a one-letter column beside the titlemre
  • 02aa74aasync components.hybriel 134b4e3: MdEditor builds an editor put into the page at once, redraws a surface put in anew (F5, hybriel#211)mre
  • 268b1c87sync components.hybriel 6b0936a: the 'edited' foldable drops the theme's border and marginmre
  • c51d039fsync components.hybriel 8d79ff7: bubble hugs its content, quiet 'edited' label; gate checksmre
  • f4ad7eecsync components 9a: shared Icon (icons/icons.hl), md-editor toolbar icons + single focus ring (components f4-icons ba96735)mre
  • db258c11sync-components: copy icons/icons.hl + README (F4); testsmre