alfa icon indicating copy to clipboard operation
alfa copied to clipboard

Scrolling down changes the outcome of an audit

Open rcj-siteimprove opened this issue 8 months ago • 1 comments

Running an audit on the same page first without scrolling and after scrolling down yields different occurrence counts.

Some targets that are above the viewport is no longer detected.

Rules relying on layout like R111, R113 and the color contrast rules are affected.

The cause is most likely that we have an implicit assumption that bounding boxes were using page coordinates and independent from the view port, but that turned out not to be the case. We should consider converting the boxes to page coordinates.

The following can be used to reproduce the issue e.g. by running the alfa-web-extension on the page with the scrollbar at the top (the color contrast issue should be detected) and then scrolling down enough so that the text is no longer visible and then refreshing the extension (the color contrast issue is no longer detected)

<!doctype html>
<style>
  div.badcontrast {
    background-color: #ffffff; /* White background */
    color: #f1f1f1; /* Light grey text */
  }
  body {
    padding-bottom: 9999px; /* To get the scrollbar to appear */
  }
</style>
<div class="badcontrast">Hello, bad contrast</div>

rcj-siteimprove avatar Jun 19 '24 14:06 rcj-siteimprove