Improved Popup Links
In lamenting our failure to achieve level-AA accessibility, I noted that we could make a quick accessibility improvement to the WBC site by slightly changing the way we link to popups on the site.
I believe there are times that launching a popup window from a link (never in the background) is actually useful on a site, such as offering contextual help without diverting the user away from the current page. We do this quite a lot for links to PDF files and RSS feeds.
In doing this, however, one has to be very careful that the links remain as accessible as possible. Two checkpoints from the WCAG are especially relevant here:
6.3 Ensure that pages are usable when scripts, applets, or other programmatic objects are turned off or not supported. If this is not possible, provide equivalent information on an alternative accessible page.
10.1 Until user agents allow users to turn off spawned windows, do not cause pop-ups or other windows to appear and do not change the current window without informing the user.
We’ve always covered our bases with the first of these. The CMS has the ability to “masquerade” any page to make it behave as if it were a different page in the site hierarchy. When a popup link is created, the URL leads to a special popups page, and features the internal ID of the page you’re coming from as pathinfo. The popup ID is then provided in the querystring.
This prompts the popups resource to “masquerade” as the resource whose ID was provided, and the querystring not only pulls out the popup content from the relevant database table, but also triggers the CMS to make the page “deep” — that is, the page acts as though its content is the result of a form submission, and a link back to itself is appended to the breadcrumb trail. This is how something like The Woking Forum gets the breadcrumb trail right for individual messages even though the CMS considers the whole Forum to be a single resource in the site hierarchy.
The result of this is that, without Javascript, the popup link acts just like it brings up a descendent of the current page, containing further explanatory information. This satisfies checkpoint 6.3 above.
This didn’t satisfy checkpoint 10.1, however, because at no point was the user informed that the link would act as a popup using Javascript. Although it’s subject to interpretation, the consensus on checkpoint 10.1 seems to be that it’s okay to open a new, or popup, window as long as the user is informed this is going to happen.
So, I thought I’d implement a variation on Gez Lemon’s script for opening external links in a new window.
You can see this in abundance on the site’s What’s New page.