diff --git a/apps/web/e2e/a11y.spec.ts b/apps/web/e2e/a11y.spec.ts index 92626bb..2d323ab 100644 --- a/apps/web/e2e/a11y.spec.ts +++ b/apps/web/e2e/a11y.spec.ts @@ -120,11 +120,22 @@ async function expectNoHorizontalScroll(page: Page, label: string): Promise { const doc = document.documentElement; const limit = doc.clientWidth; + /** Content inside its own scroll container is allowed to be wider than + * the viewport — that is the prescribed remedy, not the defect. Only + * what pushes the PAGE is a finding. */ + const insideScroller = (el: HTMLElement): boolean => { + for (let node = el.parentElement; node && node !== doc; node = node.parentElement) { + const overflowX = getComputedStyle(node).overflowX; + if (overflowX === 'auto' || overflowX === 'scroll' || overflowX === 'hidden') return true; + } + return false; + }; + const offenders: string[] = []; for (const el of Array.from(document.querySelectorAll('body *'))) { const rect = el.getBoundingClientRect(); // 1 px Toleranz gegen Subpixel-Rundung. - if (rect.width > 0 && rect.right > limit + 1) { + if (rect.width > 0 && rect.right > limit + 1 && !insideScroller(el)) { const cls = el.className && typeof el.className === 'string' ? `.${el.className.trim().split(/\s+/).join('.')}` @@ -134,7 +145,7 @@ async function expectNoHorizontalScroll(page: Page, label: string): Promise