Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-17199.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- mobile-shots: phone-ergonomics hit-rect only grows and uses layout size (#17199)
12 changes: 7 additions & 5 deletions src/pkg/dashboard/webstatic/testdata/tracker-phone-ergonomics.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@
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.
// empty ::before (the progress pill, #17183): negative insets grow the tap
// target past the painted box. Positive insets (the ?/βš™ ring drawn inside
// the --tap-target square) never shrink it. Layout size, not the client
// rect, so a one-shot transform animation (.ham-pill-moved) cannot fail it.
const hitRect = el => {
const r = el.getBoundingClientRect();
const r = { width: el.offsetWidth || el.getBoundingClientRect().width, height: el.offsetHeight || el.getBoundingClientRect().height };
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) };
const grow = v => Math.max(0, -(parseFloat(v) || 0));
return { width: r.width + grow(b.left) + grow(b.right), height: r.height + grow(b.top) + grow(b.bottom) };
};
const small = [];
for (const el of controls) {
Expand Down
Loading