(l) When pages utilize
scripting languages to display content, or to create interface elements, the
information provided by the script shall be identified with functional text
that can be read by assistive technology.
What accessibility problems can scripts
cause?
Web page authors have a responsibility to provide script information in a
fashion that can be read by assistive technology. When authors do not put
functional text with a script, a screen reader will often read the content of
the script itself in a meaningless jumble of numbers and letters. Although
this jumble is text, it cannot be interpreted or used.
How can web developers comply with this
provision?
Web developers working with JavaScript frequently use so-called JavaScript
URL's as an easy way to invoke JavaScript functions. Typically, this technique
is used as part of <a> anchor links. For instance, the following link invokes
a JavaScript function called myFunction:
<a href="javascript:myFunction();">Start
myFunction</a>
This technique does not cause accessibility
problems for assistive technology. A more difficult problem occurs when
developers use images inside of JavaScript URL's without providing meaningful
information about the image or the effect of the anchor link. For instance,
the following link alsoinvokes the JavaScript function myFunction, but
requires the user to click on an image instead of the text "Start myFunction":
<a href="javascript:myFunction();"><img src="myFunction.gif"></a>
This type of link, as written, presents
tremendous accessibility problems, but those problems can easily be remedied.
The <img> tag, of course, supports the "alt" attribute that can also be used
to describe the image and the effect of clicking on the link. Thus, the
following revision remedies the accessibility problems created in the previous
example:
<a href="javascript:myFunction();"><img src="myFunction.gif"
alt="picture link for starting myFunction"></a>
Another technique advocated by some
developers is to use the "title" attribute of the <a> tag. For instance, the
following example includes a meaningful description in a "title" attribute:
<a title="this link starts myFunction" href="javascript:myFunction();"><img
src="myFunction.gif"></a>
This tag is supported by some but not all
assistive technologies. Therefore, while it is part of the HTML 4.0
specifications, authors should use the "alt" tag in the enclosed image.
Finally, the browser's status line (at the
bottom of the screen) typically displays the URL of any links that the mouse
is currently pointing towards. For instance, if clicking on an anchor link
will send the user to http://www.usdoj.gov, that URL will be displayed in the
status line if the user's mouse lingers on top of the anchor link. In the case
of JavaScript URL's, the status line can become filled with meaningless snips
of script. To prevent this effect, some web developers use special "event
handlers" such as onmouseover and onmouseout to overwrite the contents of the
status line with a custom message. For instance, the following link will
replace the content in the status line with a custom message "Nice Choice".
<a href="javascript:myFcn();" onmouseover="status='Nice
Choice'; return true;" onmouseout="status='';"><img src="pix.gif"></a>
This text rewritten into the status line is
difficult or impossible to detect with a screen reader. Although rewriting the
status line did not interfere with the accessibility or inaccessibility of the
JavaScript URL, web developers should ensure that all important information
conveyed in the status line also be provided through the "alt" attribute, as
described above.
JavaScript uses so-called "event handlers"
as a trigger for certain actions or functions to occur. For instance, a web
developer may embed a JavaScript function in a web page that automatically
checks the content of a form for completeness or accuracy. An event handler
associated with a "submit" button can be used to trigger the function before
the form is actually submitted to the server for processing. The advantage for
the government agency is that it saves government resources by not requiring
the government's server to do the initial checking. The advantage for the
computer user is that feedback about errors is almost instantaneous because
the user is told about the error before the information is even submitted over
the Internet.
Web developers must exercise some caution
when deciding which event handlers to use in their web pages, because
different screen readers provide different degrees of support for different
event handlers. The following table includes recommendations for using many of
the more popular event handlers:
- onClick – The onClick event handler is triggered when
the user clicks once on a particular item. It is commonly used on links and
button elements and, used in connection with these elements, it works well
with screen readers. If clicking on the element associated with the onClick
event handler triggers a function or performs some other action, developers
should ensure that the context makes that fact clear to all users. Do not
use the onClick event handlers for form elements that include several
options (e.g. select lists, radio buttons, checkboxes) unless absolutely
necessary.
- onDblClick – The onDblClick event handler is set off
when the user clicks twice rapidly on the same element. In addition to the
accessibility problems it creates, it is very confusing to users and should
be avoided.
- onMouseDown and onMouseUp – The onMouseDown and
onMouseUp event handlers each handle the two halves of clicking a mouse
while over an element – the process of (a) clicking down on the mouse button
and (b) then releasing the mouse button. Like onDblClick, this tag should be
used sparingly, if at all, by web developers because it is quite confusing.
In most cases, developers should opt for the onClick event handler instead
of onMouseDown.
- onMouseOver and onMouseOut – These two event handlers
are very popular on many web sites. For instance, so-called rollover gif's,
which swap images on a web page when the mouse passes over an image,
typically use both of these event handlers. These event handlers neither can
be accessed by the mouse nor interfere with accessibility – a screen reader
simply bypasses them entirely. Accordingly, web designers who use these
event handlers should be careful to duplicate the information (if any)
provided by these event handlers through other means.
- onLoad and onUnload – Both of these event handlers
are used frequently to perform certain functions when a web page has either
completed loading or when it unloads. Because neither event handler is
triggered by any user interaction with an element on the page, they do not
present accessibility problems.
- onChange – This event handler is very commonly used
for triggering JavaScript functions based on a selection from within a
<select> tag. Surprisingly, it presents tremendous accessibility problems
for many commonly used screen readers and should be avoided. Instead, web
developers should use the onClick event handler (associated with a link or
button that is adjacent to a <select> tag) to accomplish the same functions.
- onBlur and onFocus – These event handlers are not
commonly used in web pages. While they don't necessarily present
accessibility problems, their behavior is confusing enough to a web page
visitor that they should be avoided.
Back
- Relevance to Accessibility
- Web page authors have a responsibility to provide
script information in a fashion that can be read by assistive technology. When
authors do not put functional text with a script, a screen
reader will often read the content of the script itself in a meaningless
jumble of numbers and letters. Although this jumble is text, it cannot be
interpreted or used.
- 508 Software (Subpart
B)(1194.21)
- 508 Web (Subpart B)(1194.22)
- (l)
When pages utilize scripting languages to display content, or
to create interface elements, the information provided by the script shall be
identified with functional text that can be read by assistive technology.
- 508 Functional Performance
(Subpart C)
- (a)
At least one mode of operation and information retrieval that does not
require user vision shall be provided, or support for assistive
technology used by people who are blind or visually impaired shall be
provided.
- (b)
At least one mode of operation and information retrieval that does not
require visual acuity greater than 20/70 (when corrected with
glasses) must be provided in audio and enlarged print output that works
together or independently. In the alternative, support for assistive
technology used by people who are blind or who have low vision must be
provided.
- 508 Information, Documentation, and Support
(Subpart D)
- None or In Progress of Mapping
- Comparison
- In Progress
- UAAG 1.0 Requirements & Priority
- @@
- 3.2
Toggle audio, video, animated images
Allow configuration not to render audio, video, or animated image content,
except on explicit user request. This configuration is required for content
rendered without any user interaction (including content rendered on load or
as the result of a script), as well as content rendered as the result of user
interaction (e.g., when the user activates a link)
- Who benefits: Some users with a
cognitive disability, for whom an excess of visual information (and in
particular animated information) might it impossible to understand parts of
content. Also, audio rendered automatically on load may interfere with speech
synthesizers.
- [Priority
1]
- 3.4
Toggle scripts
- Allow configuration not to
execute any executable content (e.g., scripts and applets).
- In this configuration, provide an
option to alert the user when executable content is available (but has not
been executed).
- The user agent is only required
to alert the user to the presence of more than zero scripts
or applets (i.e., per-element alerts are not required).
- Who benefits: Control of executable
content is particularly important as it can cause the screen to flicker, since
people with photosensitive epilepsy can have seizures triggered by flickering
or flashing, particularly in the 4 to 59 flashes per second (Hertz) range.
Peak sensitivity to flickering or flashing occurs at 20 Hertz.
- [Priority
1]