简体   繁体   中英

Script user interface may not be accessible. WCAG 2.0 (Level AA)

I am trying to make my site accessibility compatible.

I am using achecker.ca to see my errors.

For some reason, all of my script tags are shown as potential error according to WCAG 2.0 (Level AA) Section 2.1, Success Criteria 2.1.1, Check ID 89.

I need to get rid of these potential errors, but personally I do not know how can I make a script accessible that its only job is assigning an object. Like this script for example:

<script>
    window.dataLayer = [{
        "page_details": {
            "url": "\/us\/social-channels\/",
            "name": "Social channels"
        },
    }];
</script>

Any ideas how to solve this issue?

Looking at this specific issue, Check ID 89 , it says:

Short Description
This error will be generated for all script elements.

and then they have two examples, one passing, one failing.

Pass Examples
Does not contain a script element.
Fail Examples
Contains a script element.

So according to the doc, every <script> is going to be marked as a "potential" problem and there's no way to prevent the warning (short of removing the <script> ).

Personally, as an accessibility specialist, I think that warning is wrong. Scripts should not be flagged. If you had code where you have a mouse event handler, then that would definitely be a WCAG 2.1.1 problem. But flagging a script generically does not mean anything.

"Potential problems" means that you have to check manually. This does not mean that you have any error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM