Using GWT 1.5.2 and IE7 (both web mode and hosted mode) I am
attempting to add ALT and/or TITLE text to an Image that is sourced
from an ImageBundle, but the result is the "alt" and "title"
attributes are added to the "<gwt:clipper>" element rather than the
"<img>" element. This is an issue for screen readers like JAWS since
the screen reader expects the "alt" attribute to reside on the "<img>"
element.
Sample code:
Image clippedImage = MyImageBundle.myLogo().createImage();
DOM.setElementProperty(clippedImage.getElement(), "alt",
"clipped alt");
DOM.setElementAttribute(clippedImage.getElement(), "title",
"clipped title");
Resulting HTML:
<?xml:namespace prefix = gwt />
<gwt:clipper class=gwt-Image title="clipped title" style="PADDING-
RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; OVERFLOW: hidden;
WIDTH: 326px; PADDING-TOP: 0px; ZOOM: 1; HEIGHT: 86px"
__eventBits="131197" alt="clipped alt">
<IMG style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; MARGIN-
TOP: 0px; FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader
(src='
http://localhost:8080/a/
A29BCAE7C99015EF96C61496A2D16C34.cache.png',sizingMethod='crop');
MARGIN-LEFT: -745px; BORDER-LEFT: medium none; BORDER-BOTTOM: medium
none" height=86 src="
http://localhost:8080/a/clear.cache.gif"
width=1071 border=0>
</gwt:clipper>
Does anybody know how to force the "alt' and "title" attributes onto
the "<img>" element?
By the way, for those who do not know, you can paste the following
into your hosted mode URL bar and a new window will open showing you
the generated HTML:
javascript:void(window.open("javascript:document.open(\"text/plain
\");document.write(opener.document.body.parentNode.outerHTML)"))
Thanks,
Mark