Because a pop-up window does what it says - pops up an additional window - a user can end up feeling disoriented, not knowing the context of the new information. Most of the accessibility issues presented by pop-up windows, however, stem from the misuse of the A tag. Some developers incorrectly use this tag to trigger events, either by including JavaScript in the href attribute, or by leaving the href tag empty and overriding the onClick event.
<HTML>
<!-- This is a bad example!
<SCRIPT language="JavaScript1.1">
function X() {
alert("Yo");
window.open('http://www.google.com', "_self");
}
</SCRIPT>
<A href="javascript:X();">Test link</A>
</HTML>
A webpage always needs to remain usable without scripting, but in the code sample above, a scripting call is made directly from the href attribute. Because of this, the page works only for browsers or assistive technologies that are capable of interpreting the script.
The solution is to never call a script from the href attribute. The href should only be used for linking purposes, such as to another web page or file. Instead, you should set the target of the onFocus event to be the script.
<HTML>
<SCRIPT language="JavaScript1.1">
function X() {
alert("Yo");
window.open('http://www.google.com', "_self");
}
</SCRIPT>
<A href="http://www.google.com" onFocus="X();return false;">Test link</A>
</HTML>
Coding the event trigger using the function in the above code sample maintains the integrity of the link. Also, the script part relies on the onFocus event, which would only be seen by a script-aware browser. If the browser does not support scripting, then the link could be followed in the normal hypertext way.
The next page will discuss forms and navigation.