Alt Text

This past week has been an interesting adventure on the always exciting topic of alternate text within the scope of HTML.

Last week a co-worker of mine, Steve, put together an extension for FireFox that would display an icon in place of any broken or missing images. He created this extension because FireFox wasn’t doing anything to show that a missing or broken image existed in a given document. When you oversee several hundred (if not thousand) HTML documents, it’s nice to have some kind of visual cue that something is wrong in a page.

But that’s a bit odd. No broken image icon?

So I put together a quick test case and sure enough, no broken image icon once the page was loaded.

On a hunch, I deleted the DTD and tried again. This time the broken image icon is there. Why? Because the browser is in quirks mode.

So in standards compliance mode, Mozilla was not displaying a broken image icon.

So I headed over to bugzilla, did a quick search, and didn’t find anything related to this bug. So, thinking I was hot stuff, submitted a bug report. As has been the case with all previous bug reports of mine, someone posts a response in a day or two proving my report to be a duplicate of something else.

This case was not entirely different.

The bug I eventually marked my own report as a dup was bug #41924. This bug dates back quite a ways, to the year 2000. It starts out trying to tie down the spec for how Mozilla should handle alt text and broken/missing images. The current spec may be viewed at There is an accompanying advocacy document that is also worth reading.

The gist of the arguments presented across the bug report comments and the alt text spec are as follows.

Quirks mode is there to deliver what users expect from old, 1990s browsers. To be in line with those expectations, a broken image icon will be displayed when an image is missing or broken.

Standards mode is about how to apply various W3C docs such as the UAAG, WCAG and the HTML 4.01 spec to rendering a web page. The key idea here is that the alternate text attribute for images should provide enough information to be an adequate replacement of the image itself. If the image is broken, the alt text is displayed in its place. This substitution should not alter the information delivered by the document, only the representation of that information. If an alt attribute is empty, it is assumed there is no information in the image, and so broken images with no or missing alt text can be simply replaced with an empty inline element (essentially removed from the document). Since there is no information loss, this it is reasonable for a user agent do to this.

But I’ve still got a problem. I’m right there with Steve, having to help manage thousands of HTML docs with over a hundred separate content providers. It is not a simple task to try and educate these users on what feels a lot like theoretical HTML design. It’s not easy trying to reeducate users to think of the web and HTML pages in terms of information and how that information is interpretated. It requires a certain perspective and motivation that is really very difficult to have unless doing web development is your primary job. So my problem is that the authors of these thousands of documents don’t care enough to insert ALT text. Since that’s the case, if they develop a page with a broken image, I’m not going to see it nor be able to fix it if I’m using FireFox.

And here’s the sweet irony of my predicament. The template system into which user content is published was developed by me. This template system creates valid HTML 4.01 documents, so most of the pages I’m viewing are being seen through standards compliance mode in FireFox. The fix for my situation, however, may be quite easy. Since I created the template system, I can change it. I can make it so that on our development box, that template isn’t 4.01 valid and trigger quirks mode. The only gotchya is to make sure users still develop in standards compliance mode, otherwise the switch from the development to production box will also mean a switch in browser rendering mode, meaning the user might see an entirely different page in product than the development box.

Why does crap like this have to be so complicated?

Which is why I start to look back at the extension and think that’s probably the best way to go for now.

It is worth noting that FireFox does not yet meet its own alt text spec. Bug 180622, reported by the man behind the alt text spec, notes that FireFox does not preceed alt text with an icon to indicate that it is in fact alt text, as the spec states.

Bah. Running out of direction for this post, so that’s where I’ll leave it.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s