Should the "alt" attribute be used for tooltips?
================================================
No, because:
1. The spec doesn't say that it should.
2. Doing so encourages authors to treat the "alt" attribute as a
tooltip attribute, instead of an image replacement attribute, which
hurts accessibility.
See: http://bugzilla.mozilla.org/show_bug.cgi?id=25537#c31
3. Most major browsers don't do it. (In fact only WinIE does.)
4. Doing so causes the title attribute in constructs such as the
following to be overriden:
5. Users that need this feature can get it using extensions.
6. Authors who need this feature should use the title attribute.
7. Extremely few pages are adversely affected by not doing this.
8. Some companies have been discouraged from using "alt" attributes on
their images because they don't want them to appear as tooltips.
See: http://bugzilla.mozilla.org/show_bug.cgi?id=25537#c439
More Details
------------
SPECIFICATION
The HTML spec says that the "alt" attribute is for alternate text to
be displayed when the image is not. Thus "alt" is the same content as
the image itself. Thus it makes no sense to show it when the images
are shown.
It is true that the spec doesn't say UAs _can't_ do this. It also
doesn't say that UAs must not display elements in rows of boxes
along the top of the page, or that UAs must not hide the contents of
elements, or that UAs must not display elements five times
in the title bar.
That doesn't mean that showing "alt" attributes in tooltips is
correct. There is nothing about the "alt" attribute that makes it
appropriate for use in a tooltip.
ACCESSIBILITY
There are strong accessibility reasons _not_ to show the "alt" text,
too. To quote David Baron from Mozilla bug 1995:
| Please do *NOT* display image ALT attributes as tooltips. This
| encourages people to use ALT attributes for tooltips, which is
| wrong. ALT attributes have a very important purpose, which is to
| provide replacement text for images for 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.
...and to quote him from Mozilla bug 88297:
| TITLE has been available for some elements since HTML 3.2 (early
| 1997) and for all elements since HTML 4.0 (late 1997). ALT has been
| clearly defined as for alternate text since HTML 2.0 (November 1995,
| the first standardized HTML spec). It's just a question of whether
| we're going to propagate a mistake made in Navigator 4.x into the
| future (see below).
|
| This isn't just some silly standards-compliance nit. This is one of
| the central points of making the web accessible to users other than
| those with good vision who have high-bandwidth connections over
| which they can load images. The trend of putting ALT in tooltips
| started with Netscape 4.x, and MSIE followed, although it
| additionally (and preferentially) used TITLE, which is appropriate
| for tooltips. If we continue to use ALT for tooltips it will ruin
| the use of ALT for alternate text which is key to the accessibility
| of the web, since:
|
|
| * Authors who want to use ALT text correctly will remove it when
| they see that it's causing tooltips (that don't give any
| additional | information once you see the image) to appear in our
| browser. (Note | that application of the ADA (Americans with
| Disabilities Act) to the | Web, which is starting to happen, may
| force many authors to provide | correct ALT text whether they want
| to or not.)
|
| * Authors who want tooltips will write ALT text (rather than TITLE
| text) that is not appropriate for alternate text for the images
| and will cause pages to appear as nonsense to blind users or users
| who aren't loading or can't load images
AUTHORS
Authors who want tooltips have been able to use the title attribute
for years. Authors who are doing the right thing and giving accurate
"alt" texts, as for example in:
http://ln.hixie.ch/?start=1081717954&count=1
...would be quite annoyed to see a tooltip over the image, since it
would be duplicating the exact same content as the image (but in a
different form). So if UAs did this, they would have to explicitly
give blank title attributes, which is semantically incorrect _and_
more work for no reason. UAs should be optimising for authors who use
the standards correctly like this, not making their life harder.
HELPING THE WEB
UAs not doing this has already helped sites fix their "alt" text, and
thus made the Web a better place.