Does compliance to WCAG 2.0 AA prevent the use of JavaScript?
My understanding based on Understanding Conformance is that we can still use JavaScript as long as we don't generate any content that is noncompliant and that we explicitly state we support JavaScript. Is that correct?
The short answer is, no, it doesn't. Your understanding is pretty much correct.
A slightly longer answer is that pages can require JavaScript (AKA ECMAScript), but it's better if they don't. Use JavaScript sparingly and carefully. There's a set of guidelines for using JavaScript on WCAG 2.0 compliant pages.
Indeed, you can use JavaScript as long as we you abide by WCAG 2.0 success criteria :-)
There is a rationale why you may have heard JavaScript is banished from accessible content. In the old days of WCAG 1.0, it practically censured the use of any content generated by JavaScript. You needed to check that your web application still worked with JavaScript disabled, which practically restricted JavaScript to decorative purposes. Otherwise, you ought to provide an alternate, non-JavaScript reliant, version, which usually involved a lot of server-side magic (try and see Google Maps without JS to understand what I mean). This was because in those old days assistive technologies and even some mainstream browsers (e.g. mobile) did not support JavaScript, or browsers did not expose script-generated contents.
This is not the case anymore. You can use JavaScript in accessible, WCAG 2.0, websites, but:
- Get acquainted with WCAG 2.0 criteria and make sure you are not failing any of them. It is not a matter of using one or another technology, but a matter of using them correctly.
- In particular, check you abide by the client-side scripting techniques for WCAG 2.0 which deal with recommended and disapproved scripting usages.
- Use ARIA Techniques for WCAG 2.0 to define the semantics of non-standard controls, they are widely supported by major browsers.
You can use JavaScript. It is not a problem so long as all semantics are provided (name, state, and role) and you manage the focus accessible. Use ARIA when you need to provide semantics or manage focus.
来源:https://stackoverflow.com/questions/8383151/does-compliance-to-wcag-2-0-aa-prevent-the-use-of-javascript