Siteimprove / alfa

:wheelchair: Suite of open and standards-based tools for performing reliable accessibility conformance testing at scale
MIT License
102 stars 11 forks source link

Scrolling down changes the outcome of an audit #1626

Open rcj-siteimprove opened 2 weeks ago

rcj-siteimprove commented 2 weeks ago

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 commented 2 weeks ago

Might be worth looking into this code: https://github.com/Siteimprove/alfa/blob/56d203dc48280df03f13763018c4b513b69207d2/packages/alfa-style/src/node/predicate/is-offscreen.ts#L71