Image Caption (both the client side Javascript and the server side input filter) considers to use the IMG's TITLE attribute as its caption. Why not the ALT attribute?

ALT is specific to IMG and only few further elements. Whereas TITLE is valid in almost all HTML elements, among them also IMG.
So, I have observed Drupal and many modules, and they all seem to favor TITLE over ALT (offer TITLE by default, ALT not available at all or only as a less prominent option). Interestingly ALT it compulsory, TITLE voluntarily. So why do Image Caption and the like consider the voluntary attribute, where it would make sense to first fill the compulsory element (with real data rather than the a null string "" ), and only later the optional TITLE attribute?

Could someone please give me some reasoning? Thanks!

And the more practical question: If I want to give an IMG both an ALT and a TITLE, what aspects should be written into which attribute? Or simply the same into both?

Comments

fletchgqc’s picture

Interesting question. When I wrote the filter option I copied the existing behaviour. In most cases they will probably be the same. However there is a difference - alt is "alternative text" - used to describe what is in the picture for those that can't see it whereas title is, I guess, giving a title to the picture which is in our case what we are doing. You may actually wish the description/alt text to be different to the caption - sometimes you can put something humourous in the caption which is only funny if you can see the picture.

I should probably patch it so that if there is no alt text, then the title text is used. That way you can just fill in one.