Skip to content

Link-in-text-block problems #3774

@straker

Description

@straker

The recent changes to link-in-text-block rule has a few problems. First, the data is not converting the colors into hex, so the failureSummary is using [Object object] instead of the hex color. Also, the contrast is not being truncated so the contrast is very long decimal number.

"Fix any of the following:
The link has insufficient color contrast of 1.6620953314177012:1 with the surrounding text. (Minimum contrast is 3:1, link text: [object Object], surrounding text: [object Object])
The link has no styling (such as underline) to distinguish it from the surrounding text"

Lastly, the issue is reporting false positives for the following HTML:

<p>hello world, goodbye world
  <a href="#" style="text-decoration: none; background: #eee;">
    <style>a { color: #333 }</style>
    <img src="https://randomuser.me/api/portraits/men/54.jpg" alt=""/>
  </a>
</p>

The matches function uses textContent to determine if the link has text, but textContext grabs the text of the style element so it passes the matches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixBug fixesprA pr has been created for the issuerule metadataIssues in the rule metadata code (lib/rules)rulesIssue or false result from an axe-core rule

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions