Skip to content

Unable to test contrast of nodes scrolled out of view #3772

@WilcoFiers

Description

@WilcoFiers

This problem was introduced in axe-core 4.5. When an element is scrolled out of view, it is not included in the grid, which results (among other things) that it is reported as incomplete once its scrolled out of view.

Here's how to reproduce the problem. These logs should report the same, but the second one reports incomplete instead of a violations.

<h1 style="color: #ABC">Hello World</h1>
<main style="background: #CDF; height: 800px;"></main>
<script src="/axe.js"></script>
<script>
  window.onload = async () => {
    window.scrollTo(0, 0);
    const res0 =  await axe.run({ runOnly: 'color-contrast' })
    console.log({ violations: res0.violations, incomplete: res0.incomplete })

    window.scrollTo(0, 1000);
    const res1 =  await axe.run({ runOnly: 'color-contrast' })
    console.log({ violations: res1.violations, incomplete: res1.incomplete })
  }
</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    color contrastColor contrast issuesfixBug fixesprA pr has been created for the issuetarget-size

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions