Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

violation message string contains interpolated value, but is verbatim in JSON report #3384

Closed
danielweck opened this issue Feb 6, 2022 · 2 comments
Labels
fix Bug fixes pr A pr has been created for the issue rule metadata Issues in the rule metadata code (lib/rules)

Comments

@danielweck
Copy link

danielweck commented Feb 6, 2022

Product: axe-core

Expectation: violation message string interpolation should work

Actual: message appears verbatim, variable not substituted

Motivation: user text is not useful


axe-core version: 4.4.1

Any OS, any web browser

Source reference:

"fail": "The role used is deprecated: ${data.values}"

Verbatim message: The role used is deprecated: ${data.values}:

    {
        "id": "aria-roles",
        "impact": "minor",
        "tags": [
            "cat.aria",
            "wcag2a",
            "wcag412"
        ],
        "description": "Ensures all elements with a role attribute use a valid value",
        "help": "ARIA roles used must conform to valid values",
        "helpUrl": "https://dequeuniversity.com/rules/axe/4.4/aria-roles?application=axeAPI",
        "nodes": [
            {
                "any": [],
                "all": [],
                "none": [
                    {
                        "id": "deprecatedrole",
                        "data": "doc-endnote",
                        "relatedNodes": [],
                        "impact": "minor",
                        "message": "The role used is deprecated: ${data.values}"
                    }
                ],
                "impact": "minor",
                "html": "<p xmlns=\"http://www.w3.org/1999/xhtml\" role=\"doc-endnote\" xmlns:epub=\"http://www.idpf.org/2007/ops\" epub:type=\"rearnote\">bla bla</p>",
                "target": [
                    "p"
                ],
                "failureSummary": "Fix all of the following:\n  The role used is deprecated: ${data.values}"
            }
        ]
    }

To reproduce, create index.html and open in web browser + inspect debugger console to see Axe's JSON output:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="en" xml:lang="en">
<head>

<title>TITLE</title>

<script src="https://unpkg.com/axe-core@4.4.1/axe.min.js"></script>

</head>
<body>

<section role="doc-chapter">
<p role="doc-endnote" epub:type="rearnote">bla bla</p>
</section>

<script type="javascript">
    window.axe
    .run()
    .then(results => {
        console.log(JSON.stringify(results.violations, null, 4));
        console.log(results.violations.length);
    })
    .catch(err => {
      console.error('Something bad happened:', err.message);
    });
</script>
</body>
</html>
@straker
Copy link
Contributor

straker commented Feb 7, 2022

Thanks for the issue. Confirmed the problem and we'll try to get a fix out for the next release.

@straker straker added fix Bug fixes rule metadata Issues in the rule metadata code (lib/rules) labels Feb 7, 2022
@straker straker added this to the Axe-core 4.5 milestone Feb 7, 2022
@WilcoFiers WilcoFiers added the pr A pr has been created for the issue label May 20, 2022
@WilcoFiers WilcoFiers removed this from the Axe-core 4.5 milestone May 20, 2022
@padmavemulapati
Copy link

Validated with the latest axe-core develop branch code base, source - axe.js
Where in fix saying
failure summary for the deprecated roles completely not appearing as ${data.values} but appearing as
"failureSummary: "Fix all of the following:\n The role used is deprecated: doc-endnote" "
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fixes pr A pr has been created for the issue rule metadata Issues in the rule metadata code (lib/rules)
Projects
None yet
Development

No branches or pull requests

4 participants