Skip to content

Color contrast checks result in an error when axe-core is run from an extension #3837

@thuey

Description

@thuey

Product

axe-core

Product Version

= 4.6.0

Latest Version

  • I have tested the issue with the latest version of the product

Issue Description

Expectation

I expect it to correctly identify color contrast issues

Actual

It does not identify color contrast issues. Instead, an error message is logged to the results:

TypeError: setting getter-only property "right"

How to Reproduce

Run axe-core >= 4.6.0 in an extension. (Feel free to reach out, and I can help you get set up with an extension with axe-core >= 4.6.0)

Additional context

I have traced down the issue and am submitting a PR to fix it. The issue is axe-core is trying to set DOMRect.right here:

nodeRect.right = nodeRect.left + nodeRect.width;
. However, DOMRect.right (and DOMRect.bottom) is a read-only property.

Unfortunately, browsers seem to enforce this inconsistently, and it is only actually enforced from the isolated world that an extension content script runs in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    prA pr has been created for the issuetech debtTechnical debt related taskstestsIssues that deal with the unit or integration tests

    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