From de3b39928c0702bcef0cf4434bdb7bb0350641f6 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Sat, 7 Nov 2026 20:50:00 -0700 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20mobile-shots:=20phone-ergono?= =?UTF-8?q?mics=20probe=20measures=20pseudo-element=20hit=20areas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The progress pill (#17183) keeps a compact painted box and widens its hit area to --tap-target with an absolutely positioned ::before. The tap-target probe only measured the painted box, so the 390×844 gate went red once both landed on v5. Measure the union of the element and its absolute ::before/::after instead. Signed-off-by: Andrew Anderson --- .../testdata/tracker-phone-ergonomics.js | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-phone-ergonomics.js b/src/pkg/dashboard/webstatic/testdata/tracker-phone-ergonomics.js index 62bc632337..06e4762bc4 100644 --- a/src/pkg/dashboard/webstatic/testdata/tracker-phone-ergonomics.js +++ b/src/pkg/dashboard/webstatic/testdata/tracker-phone-ergonomics.js @@ -30,19 +30,26 @@ const stripCell = el => el.matches('.ham-chevron-info, .ham-chevron-decision, .ham-chevron-copy .ham-decision-trigger'); const controls = [...section.querySelectorAll('button, a[href], input, select, summary, [role="button"], [role="menuitem"], [tabindex]:not([tabindex="-1"]):not(.ham-row):not(.ham-sub)')] .filter(el => visible(el) && !inlineText(el) && !stripCell(el)); - // A compact control may extend its hit area with an absolutely positioned - // empty ::before (the progress pill, #17183): its tap target is the pseudo - // box, not the painted box. Negative insets grow the rect. - const hitRect = el => { + // A control may extend its hit area past its painted box with an + // absolutely positioned ::before/::after (the progress pill's + // `inset: calc((compact - tap) / 2) 0`): measure the union of the + // element and such pseudo-elements, since that is what the thumb hits. + const px = v => { const n = parseFloat(v); return Number.isFinite(n) ? n : 0; }; + const hitBox = el => { const r = el.getBoundingClientRect(); - const b = getComputedStyle(el, '::before'); - if (b.position !== 'absolute' || b.content !== '""' || getComputedStyle(el).position === 'static') return r; - const px = v => parseFloat(v) || 0; - return { width: r.width - px(b.left) - px(b.right), height: r.height - px(b.top) - px(b.bottom) }; + let { left, top, right, bottom } = r; + if (getComputedStyle(el).position === 'static') return { width: right - left, height: bottom - top }; + for (const pseudo of ['::before', '::after']) { + const cs = getComputedStyle(el, pseudo); + if (cs.content === 'none' || cs.position !== 'absolute' || cs.pointerEvents === 'none') continue; + left = Math.min(left, r.left + px(cs.left)); top = Math.min(top, r.top + px(cs.top)); + right = Math.max(right, r.right - px(cs.right)); bottom = Math.max(bottom, r.bottom - px(cs.bottom)); + } + return { width: right - left, height: bottom - top }; }; const small = []; for (const el of controls) { - const r = hitRect(el); + const r = hitBox(el); if (r.width + tolerance < 44 || r.height + tolerance < 44) small.push(`${el.tagName.toLowerCase()}.${[...el.classList].join('.')} ${Math.round(r.width)}×${Math.round(r.height)}`); } assert(small.length === 0, `${small.length} control(s) under 44×44 at 390×844: ${[...new Set(small)].slice(0, 12).join(', ')}`); From 28ceddce0b4ccc4d5a327e4a3d5117aedb581914 Mon Sep 17 00:00:00 2001 From: clubanderson <407614+clubanderson@users.noreply.github.com> Date: Sun, 8 Nov 2026 03:50:31 +0000 Subject: [PATCH 2/2] changelog: fragment for #17196 Generated by changelog-fragment-guard from the PR title (#5675). Edit the wording freely, or replace this file with the no-changelog label if the change is not user-visible. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: clubanderson <407614+clubanderson@users.noreply.github.com> --- changelog.d/fixed-17196.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/fixed-17196.md diff --git a/changelog.d/fixed-17196.md b/changelog.d/fixed-17196.md new file mode 100644 index 0000000000..4f767e6d5e --- /dev/null +++ b/changelog.d/fixed-17196.md @@ -0,0 +1 @@ +- mobile-shots: phone-ergonomics probe measures pseudo-element hit areas (#17196)