Click to See Complete Forum and Search --> : ALT & Title Bug?
FredAt
12-28-2006, 07:24 AM
While testing a site which uses image maps in IE6 and FF2 I found that while FF shows up the map area TITLE attribute correctly as I hover over it, IE6 actually shows the ALT attribute instead.
Is this a known bug and if so what can I do about it - apart from setting the same text for ALT and for TITLE. I'd much appreciate any help.
Yes, it's a known bug. There's not much you can do, excepting leaving out the alt attribute.
Charles
12-28-2006, 08:30 AM
[E]xcepting leaving out the alt attribute.Heaven forbid! Well, there is always the server side sniff. Or this client side solution:<!--[if IE]>
<script type="text/javascript">
onload = function () {
var e, i = 0
while (e = document.getElementsByTagName ('*') [i++]) {
if (e.alt) e.alt = ''
}
}
</script>
<![endif]-->
FredAt
12-28-2006, 08:49 AM
Heaven forbid! Well, there is always the server side sniff. Or this client side solution:<!--[if IE]>
<script type="text/javascript">
onload = function () {
var e, i = 0
while (e = document.getElementsByTagName ('*') [i++]) {
if (e.alt) e.alt = ''
}
}
</script>
<![endif]-->
Thanks. However, setting ALT to a null string - either through selective JavaScript or hardcoded - is not an option. I am using an image map with links back to the current page to show a "hint" on what different portions of the image do. So, I need the hover to work - even if it is at the cost of setting the same content for TITLE and ALT to ensure that they work in FF and IE.
(Charles -- I thought you were anti-javascript! :eek: ) :)
kiwibrit
12-28-2006, 08:53 AM
Yes, it's a known bug. There's not much you can do, excepting leaving out the alt attribute.
I wouldn't do that. The alt text helps screen readers, and with images disabled, describes missing images.
I wouldn't do that. The alt text helps screen readers, and with images disabled, describes missing images.
I agree -- I just meant there's not a simple work-around besides leaving it out, or having duplicate text in the title/alt. :p
Charles
12-28-2006, 09:07 AM
(Charles -- I thought you were anti-javascript! :eek: ) :)Not all, just banned from the JavaScript forum for insisting that JavaScript has its place but must be used with care.
You'll note that my solution above keeps the alt-text for those who need it but keeps things limping along with MSIE.
felgall
12-28-2006, 01:58 PM
For ordinary images the simplest fix for the IE alt bug is to ensure that you always supply a title attribute for all images even if it is empty.
For image maps Charles' solution is the best that is possible since it only removes the alt attributes that cause the buggy behaviour in Internet Explorer with JScript enabled (which is the main situation where the bug occurs).