WebAIM - Web Accessibility In Mind

E-mail List Archives

RE: Popup Window idea

for

From: Austin, Darrel
Date: Jul 25, 2005 8:57AM


> As an example, I am writing a script to allow for
> "accessible" pop-up windows. I had an idea I hadn't seen yet
> before and wondered if I should pursue with it.

Is that something we actually need? ;o)

> Here's the deal:
>
> * We cannot assume that the user agent allows for popup windows
> * When we use HTML and the target attribute, we can open a
> window, but cannot "style" it or close it with a link
> * When we have JavaScript enabled and we have a
> window.opener, we can assume that the window was opened and
> we can add window.close() links.

Furthermore, I'd add:

* We can not assume that the end-user wants pop-ups
* We can not assume that the end-user isn't in control of their own
tabs/windows
* while the target attribute works, it's not valid xhtml and that
may cause issues with certain sites. Additionally, many folks
believe that javascript is the proper technology for modifying
the windows, pop-ups being one of those places to use it.

> Therefore I considered using link relationships in
> conjunction with a script to make the whole process failsafe:
> <a href="popup.html" rel="popup">popup</a>

That an absolute necessity, as many folks prefer to open windows how they
see fit...either dragging links back and forth between windows, or clicking
links to open in new tabs, etc.

> would be changed by the script to a link opening the new
> window and get a message attached that it does so.
> <a href="parent.html" rev="popuptrigger">back</a>

At this point, I'd have to strongly suggest that if you have a need for a
'back' link in a pop-up, then you shouldn't be using a pop-up window to
begin with.

Also, this type of behavior will act oddly if one hadn't popped up the
specific window. Ie, if I open your window in a new tab, why would 'back'
then close my tab?

> Any comments why that is a bad idea and what would be a better one?
> Yes, I will point out that popups should be avoided.

I wouldn't bother with the whole 'back' issue. Instead, I'd focus more on
the presentation of the link itself. Emphasize that if you are going to
create a pop-up link, do the following:

- retain an actual HREF (for the reasons noted above)
- make the link clearly indicate that a pop-up window will appear
(via an icon or text)
- when possible, have the pop-up link icon/text be written/styled by
javascript. If the client doesn't have javascript, then they won't
be confused with the pop-up links.
- make the pop-up window artificially small (yet resizable) so that
it is clear that a new window was created.

If it's clearly a link to a pop-up window, then they will be more aware that
a new window is coming. At that point, they can usually fine the 'close
window' widget themselves.

-Darrel