Closed Bug 395390 Opened 17 years ago Closed 16 years ago

alternative text shown for broken images is not updated if the alt attribute changes

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: kampde, Unassigned)

References

Details

(Keywords: access)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; es-ES; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; es-ES; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6

The alternative text for images is visible when the image is not loaded (if the user disables images or the url of the image is incorrect or whatever). It seems that firefox only reads that 'alt' attribute when it tries to load the image. If later this 'alt' attribute changes (i.e. because of a script), the text shown to the user does not change. Inspecting the element with the DOM inspector one can see that the value has really changed, is just the UI that is not updated.

Reproducible: Always

Steps to Reproduce:
this piece of code shows the problem. When loaded, you see this text: 'initial' and no image, because the url is incorrect. When clicking the 'image' (or the alternative text), the alt attribute is modified by the effect of the onclick handler, but the UI is not updated to show the new value of the alt attribute.

<html>
<head>
  <title>firefox bug</title>
<script type='text/javascript'>
function changeAltText(img)
{
	img.alt = img.alt + '. I'M INVISIBLE!';
}
</script>
</head>
<body>
<img src='nonexistent.jpg' onclick='changeAltText(this);' alt='initial' />
</body>
</html>

Actual Results:  
After clicking the missing image, the text shown is still 'initial'.

Expected Results:  
After clicking the missing image, the text shown should be 'initial. I'M INVISIBLE!'

I have reproduced the bug on firefox 2.0.0.6 on both windows vista & windows XP SP2, but probably in all other environments happens as well.
Component: Disability Access → Layout
Product: Firefox → Core
QA Contact: disability.access → layout
Keywords: access
This got fixed by the changes for bug 11011.

I just checked in that testcase (with the quotes changed so it works) as a regression test.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Depends on: moz-broken
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.