Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 917
ergunysr Avatar asked Jun 02 '26 19:06

ergunysr


1 Answers

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.

like image 55
slugolicious Avatar answered Jun 04 '26 07:06

slugolicious