Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Voices That Matter

This chapter is from the book

This chapter is from the book

E: Accessibility overview

I’ve already mentioned accessibility many times, usually coupled with some snide remarks about the general lack of it in JavaScript development. It’s time for a more formal overview, as well as an accessibility test of the example scripts.

What is accessibility?

Accessibility means that your pages remain accessible to anyone, under all circumstances, especially when the user suffers from a condition she cannot change, for instance diminished eyesight, or has a browser that does not support (sufficient) JavaScript.

What does “remain accessible” mean in a JavaScript context? It means that the user must be able to read the content of the site, use the navigation, and perform common operations like submitting a form. Nothing less, but also nothing more.

Making every site perfectly accessible in all situations is rather a tall order, and we’ll see that at the time of writing it is not yet possible because of some tricky technical issues with screen readers. Nonetheless, we should make a start, and since we are able to solve some accessibility problems, we should do so.

Noscript

The clearest accessibility problem, the one that everybody’s able to name, is that some browsers will not support (sufficient) JavaScript. Your carefully crafted scripts don’t work in these browsers, and their users will see an unscripted page.

Priority One of writing accessible scripts is, therefore, to make sure that the page functions without JavaScript. We’ll discuss the gory details later, but first I’d like to point out two less well-known but still serious accessibility problems.

No mouse

Some users don’t use a mouse, but instead navigate the Web through keystrokes. Some use the keyboard, but others might use widgets like on-screen keyboards, or devices that emulate a keyboard.

Their reasons for using keystrokes instead of mouse gestures may vary. I myself occasionally use the keyboard for some quick operations, and this is obviously my own choice. I could reach for the mouse, but sometimes I’m too lazy to do so.

Other users, though, may be forced to use the keyboard continuously for reasons they’re not able to change. The most likely scenario is that these users are (partially) disabled in their hands and cannot perform the rather subtle movements necessary to guide the mouse. Keystrokes offer a good alternative for these users—except when a JavaScript developer has forgotten to take them into account.

Usually these users’ browser is able to execute advanced scripts, and the user is able to see the results when they appear on the computer screen. Thus there’s really no problem, except that the scripts don’t react to keyboard input.

In order to make your scripts keyboard-compatible, you should define extra events in addition to normal mouse events. For instance, if you use a mouseover event you should also use a focus event, since without a mouse no mouseover event will ever take place. We’ll discuss this specialized area of accessibility in 7B when we treat the available JavaScript events.

Screen readers

Some people cannot use a normal browser. Typically, these are blind or severely sight-impaired people who simply cannot read anything from a computer screen. Instead, they need a program that reads the content of the page out loud. These programs are known as screen readers.

JavaScript developers used to think that screen readers were essentially noscript browsers, and therefore accessibility for screen-reader users was an extension of accessibility for noscript users. As long as the page works without JavaScript, blind users would not suffer from JavaScript-related problems (though plenty of other problems like missing alt attributes still remained).

Unfortunately, this is a myth. Most screen readers are programs that run on top of an existing browser—usually Explorer, sometimes Mozilla. Since they use a normal browser to get their data, they also support JavaScript. When the underlying browser encounters a script, it tries to execute it normally.

This seems to be good news. If screen readers also support JavaScript, there’s no problem, right? Unfortunately, there are two very serious ones: the linear nature of screen readers, and their chaotic events support.

A screen reader offers only linear access to a page. When a sighted user with a graphic browser visits a site, she gets a quick overview of all possibilities simply by looking at it. The bunch of odd-color bits on the left will probably be the main navigation, the text in the middle is obviously the main content, etc. Thus the user can quickly determine which parts of the page she needs, and interact only with those parts. In addition, as soon as a script changes the document structure or presentation, her eye is drawn to this change and she can evaluate its meaning.

Not so with screen-reader users. A screen reader reads the page from top to bottom, usually in source code order. This is a severe problem to modern JavaScript. Even if all screen readers supported JavaScript perfectly (which they don’t, not by a long shot), how would we alert their users to the fact that (parts of) the page have changed, especially when the screen reader has already read those parts?

Take Form Validation, in a hypothetical screen reader that supports perfect JavaScript. Screen readers allow their users to fill out forms and to submit them. Since JavaScript works fine, Form Validation runs when the user activates the Submit button, and if it finds errors, the script places error messages next to faulty form fields, alerts “Errors have been found,” and halts the form submission.

The problem is that a screen-reader user may (usually but not always!) hear the alert and get an inkling of the problem, but since the reader has already read past the form fields themselves, he won’t hear the error messages themselves.

To help screen-reader users, Form Validation scrolls back to the start of the form:

[Form Validation, lines 100-103]

<form id=”startOfForm”>
if (!validForm) {
	alert(“Errors have been found”);
	location.hash = ‘#startOfForm’;
}

This is useful to both sighted and blind users; both groups will appreciate being sent back to the start of the form so that they can mend the errors of their ways. Nonetheless, it’s important to note that this feature is a nice extra for a sighted user, but an absolute necessity for a screen-reader user.

Screen readers and events

Unfortunately, the events support of screen readers is extremely confused and chaotic. In theory you’d expect them to support interface events like focus and blur, but not mouse events like mouseover and mouseout, because screen-reader users use a keyboard (or an equivalent device) to give input.

Unfortunately, some (but not all) screen-reader vendors have seen fit to include mouse events anyway. The reason is, of course, that most sites use only mouse events because their creators never seriously considered keyboard accessibility. Screen-reader vendors want their programs to treat these pages correctly, too, and therefore added mouse event support. Of course this creates serious problems when an accessibility-aware Web developer wants to carefully separate screen readers from graphic browsers to give them special treatment.

I’m deliberately not going to give details; they’d just confuse you (and me), and screen-reader event support is likely to change when new versions are released. Suffice it to say that you cannot assume anything about screen-reader event support.

The situation is in fact so bad that I fear accessibility is just not possible in the generation of screen readers current at the time of writing. It was Derek Featherstone who drew the harsh but correct conclusion, “We can deal with JavaScript on or off, but we can’t deal with in between,” and therefore he feels it’s better to ask users of older screen readers to disable JavaScript entirely. If they do, they’ll fall back to a noscript page, and that’s a situation we can handle.

At the moment, and speaking from the scant knowledge we have about screen-reader JavaScript support, I’m forced to agree with him, albeit reluctantly. Noscript screen readers are far easier to cater to than script-enabled screen readers.

Accessibility and usability

This brings us back to our starting point: any Web page should remain accessible when a browser does not support (sufficient) JavaScript. Before treating the practical accessibility of the example scripts, we first have to discuss a few general rules.

We should carefully consider JavaScript’s purpose, which, as we saw in Chapter 1, is the addition of an extra layer of usability to a Web site. As soon as JavaScript is disabled, a Web site’s usability will suffer—after all, an entire layer disappears. But the absence of this layer should not hamper the page’s basic accessibility.

Take Usable Forms. When the script works, it makes sure that users will see certain form fields only when they actually indicate they need them. The “Date of divorce” field will remain hidden until the user indicates he is, in fact, divorced.

When the script does not work, the user sees all form fields he may possibly need. From a usability perspective, this is obviously undesirable: the more form fields the user sees, the more confused or irritated he becomes, and the more likely to decide not to bother with the form at all.

Nonetheless, the page remains perfectly accessible, and I’ve done my duty as a Web developer. The user is able to fill out the form and submit it to the server, even if without my nifty script the process will become more time-consuming and confusing. The user might be less willing to fill out the form because it’s so huge and confusing, but that’s something we can’t help. When JavaScript is not supported, usability suffers.

Don’t restrict usability

Accessibility should not restrict usability. If you have an excellent idea to increase your site’s usability that won’t work without JavaScript, use it—just make sure that it’s possible (not necessarily easy, just bare-bones possible) to use the page without it.

Perfect accessibility does not consist of offering exactly equal functionalities to script and noscript users. Sometimes that’s flat-out impossible, and at other times the attempt will backfire with a vengeance.

For instance, let’s try to create the Usable Forms effect without JavaScript. You could serve a form without the optional fields first, let the user submit it to the server, and send back an extended form with the “Date of divorce” field when your server-side scripts notices the user has checked the “Divorced” radio button. Technically, this could work.

However, from a user-experience point of view, it is far worse than the noscript form we just studied. Although that form may be confusing and is certainly less usable than the scripted version, at least it doesn’t confront the user with extra downloads and fields at the moment he thinks he’s successfully submitted the form.

In general, it’s far better to accept the diminished usability of a noscript page than to try to work around it.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email ask@peachpit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.peachpit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020