Question

I wanted to get something cleared up and that is the use of Javascript on websites with regards to WCAG.

Am i correct that the use of Javascript is fine as long as it does not stop a user from accessing the content of the website or achieve an action on a website.

For example if a website required Javascript to login to a website i would assume this would be breaking WCAG?

Also if a site had something to purchase with options to configure that required Javascript to complete would also break WCAG?

Using AJAX is fine as long as the user is alerted that the page has been updated (could use ARIA)

My assumptions are that Javascript should be used to enhance the experience but not be relied on so a user can achive the goal without it?

Are these assumption correct?

Was it helpful?

Solution

WCAG 2 does not prevent you from using or relying on JavaScript.

There is no guideline that prevents it, you might refer to the concept of 'accessibility supported', but all the mainstream browsers & screen readers support JavaScript so that isn't an issue.

Matt May (author of an excellent book on accessibility) wrote pretty much the definitive response to the 'is JavaScript required' question.

What you would miss by focusing on making a site work without JavaScript would be that most people with access issues would receive the JavaScript. Therefore you need to make the JavaScript version accessible.

Aspects such as keyboard focus, ARIA and suitable HTML structure (even if created by JavaScript). I wrote an explanation of what you'd need to focus on for an accessible Angular.js implementation, but it applies for most JavaScript reliant sites.

Having said that, progressive enhancement is a useful method as some people (regardless of disability) don't receive JavaScript (about 1.1% according to the UK Government site). I know it was just an example, but requiring JavaScript for a simple login form would seem pretty lame!

OTHER TIPS

Yes, your assumption is right, JS should enhance the usability but not the accesibility.

The classical example is a field in a form where there is AJAX autocompletion/suggestions: without JS you will have to complete all the value by hand, but is still usable. The same for checking values as email addresses, where a client-side validation is usually welcomed, but the server-side one is mandatory. Just check Q&A here: Javascript and Accessibility

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top