Request for enhancement to radio.macros.imageRef ()


I've been doing some light testing of the Mozilla Firebird browser the last few days. Today, I was making some changes to one of my stories that has some images in it and noticed that Mozilla Firebird was not displaying the tooltips for the images, even though the img tags had correct alt attributes.

I did a little research to find out if this was a bug in Mozilla Firebird. Despite the fact that this "bug" has been reported dozens of times for Mozilla and Mozilla Firebird, the developers insist this is not a bug:

Many sites uses the alt HTML property to display tooltips for images. This is wrong. The correct property to use for tooltips is title. The alt property has a very important purpose, which is to provide replacement text for images in browsers that cannot or do not (by user's choice) display images, and if graphical browsers display them as tooltips people will be discouraged from using them for their correct purpose. For more information about this, read Mozilla Bug 25537. In other words, it's up to the web developers to use the right HTML property for tooltips. If you are in doubt, read here for more information.

However, there is an extension that will enable the display of the alt property as a tooltip. You can install it from the Extensions page.

Mozilla's developers have no intention of changing Mozilla's and Firebird's behavior to display an image's alt attribute as a tooltip. Radio's radio.macros.imageRef () macro does not put a title attribute into the img tag it creates, nor does it give the user a way to supply one, so Mozilla and Firebird will not display a tooltip for an image displayed with the radio.macros.imageRef () macro.

There are a number of possible solutions to this issue, both for Radio Userland's programmers and for Radio's users.

Some options for Radio Userland's programmers:

1. Modify radio.macros.imageRef () to accept an optional title parameter. Within radio.macros.imageRef (), this title parameter should be passed to radio.images.imageRef (), which actually builds the img tag. Modify radio.images.imageRef () to accept an optional title parameter as well. Include the title attribute in the img tag output by radio.images.imageRef () if the title parameter is present.

2. Modify radio.images.imageRef () so that if an alt parameter is present, both an alt attribute and a title attribute are output. Use the text of the alt parameter as the value for both the alt and title attributes in the img tag. This would violate the spirit of what Mozilla's developers intend for web authors to do, but it does fix the problem.

An interesting note: Some of Radio's other macros (radio.macros.mailTo (), rssLink, radio.macros.xmlCoffeeMug (), for example), create a graphic link and supply a title attribute in the <a href> tag surrounding the img tag.  This is the same method as the next option described below.

Some options for Radio's users:

1. If the image in question is also a link (the img tag is surround by <a href>.....</a> tags), a title attribute can be added to the <a href> tag and Mozilla / Firebird will display the href's title attribute as a tooltip when the mouse hovers over the image.


Mozilla and Firebird will not display a tooltip using this code in your template:

<a href="LinkToSomePage.html"><%radio.macros.imageRef ("images/myImage.jpg" alt="This is tooltip text!")%></a>

Mozilla and Firebird will display a tooltip if this code is used:

<a href="LinkToSomePage.html" title="This is tooltip text!"><%radio.macros.imageRef ("images/myImage.jpg")%></a>

2. Replace <%radio.macros.imageRef ()%> in the template with different code that builds an img tag with a proper title attribute. One approach is to use the <%radio.macros.imageUrl ()%> macro instead.


Instead of using the radio.macros.imageRef () macro:

<%radio.macros.imageRef ("images/myImage.jpg" alt="This is tooltip text!")%>

Replace it with this code, using the radio.macros.imageUrl () macro:

<img src="<%radio.macros.imageUrl ("images/myImage.jpg")%>" border="0" width="130" height="150" title="This is tooltip text!">

A possible disadvantage to this approach is that radio.macros.imageUrl () macro will not automatically create a local copy of the image on your server.

3. Install the Popup ALT Attributes extension for Mozilla Firebird. (I do not know if this extension is available for Mozilla users.) This extension will force Firebird to display an image's alt attribute text as a tooltip. However, this only works for your browser. Other readers who visit your weblog with the Mozilla / Firebird browser and do not have this extension installed still will not see tool tips for images that have no title attribute.

I would prefer that Radio's programmers modify the radio.macros.imageRef () macro to support an optional title parameter (the first option I described). The programming is not that difficult. Users will then be able to generate img tags that conforms to standards, and their web pages will have the correct behavior in standards-compliant browsers such as Mozilla and Firebird.


Oops... See what I said in the post above. They are right. It is not a bug. Just because MSIE does it wrong doesn't mean everyone should!

Since Internet Explorer's share of the browser market is approximately 95%, doesn't that pretty much mean that everyone *is* doing it?

I agree in principle with both you, Kathy, and Firebird's developers. I have to wonder though, how successful Firebird's developers think they will be in "re-educating" millions of site designers who have done it wrong.

The thing I don't like about it is this: a web designer can incorrectly use the alt attribute on an image, intending it to be displayed as a tooltip. When a user visits such a site with the Mozilla or Firebird browsers, the user never knows that any tooltip was supposed to be displayed unless they look at the HTML source. If the user doesn't know, how is the web site designer ever going to find out the right way to code a tooltip for an image?

About this Entry

This page contains a single entry by TweezerMan published on September 9, 2003 3:59 PM.

Getting Radio to open the Desktop Website in Mozilla Firebird during startup - Part 3 was the previous entry in this blog.

Initial experiences with Mozilla Firebird and Radio is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 6.1.2

MT-Vampire plugin

web hosting by TotalChoice Hosting

Valid XHTML 1.0!
Valid CSS!