diff --git a/e2e/studio.spec.ts b/e2e/studio.spec.ts index a699725..c701413 100644 --- a/e2e/studio.spec.ts +++ b/e2e/studio.spec.ts @@ -220,14 +220,18 @@ const audit = (page: Page, label: string) => page.evaluate((label) => { if (r.width < 4 || r.height < 4) continue; const cs = getComputedStyle(el); if (cs.position === 'fixed' || cs.visibility === 'hidden') continue; - let p = el.parentElement, box: DOMRect | null = null; + let p = el.parentElement, box: DOMRect | null = null, scrollable = false; while (p && p !== document.body) { const ps = getComputedStyle(p); - if (/(hidden|auto|scroll|clip)/.test(ps.overflowX) || ps.position === 'fixed') { box = p.getBoundingClientRect(); break; } + if (/(hidden|auto|scroll|clip)/.test(ps.overflowX) || ps.position === 'fixed') { + box = p.getBoundingClientRect(); + scrollable = ps.overflowX === 'auto' || ps.overflowX === 'scroll'; + break; + } p = p.parentElement; } const left = box ? box.left : 0, right = box ? box.right : vw; - if (r.left < left - 2 || r.right > right + 2) { + if (!scrollable && (r.left < left - 2 || r.right > right + 2)) { const txt = (el.innerText || el.getAttribute('aria-label') || el.tagName).trim().replace(/\s+/g, ' ').slice(0, 40); out.push(`${label} | ${Math.round(r.left)}-${Math.round(r.right)} in ${Math.round(left)}-${Math.round(right)} | ${txt}`); }