[OpenLayers-Users] Bug in a alternative text for control icons

Christopher Schmidt crschmidt at metacarta.com
Wed Jan 24 10:20:23 EST 2007


On Wed, Jan 24, 2007 at 04:17:47PM +0100, Yves Jacolin wrote:
> Le Mercredi 24 Janvier 2007 15:31, vous avez ?crit?:
> > On Wed, Jan 24, 2007 at 03:00:47PM +0100, Yves Jacolin wrote:
> > > Le Mercredi 24 Janvier 2007 14:46, vous avez ?crit?:
> > > > On Wed, Jan 24, 2007 at 02:34:22PM +0100, Yves Jacolin wrote:
> > > > > Hi,
> > > > >
> > > > > Controls icons in the map not seems to have alternative text for img
> > > > > html tags. However, in the code I can read :
> > > > >         btn.alt = title;
> > > > > Does it means that it should be display the alt. text ?
> > > >
> > > > I believe that setting the alt attribute on an image should cause it to
> > > > display in IE. We should also add the title attribute, which is what FF
> > > > uses for hovers. Please feel free to file a ticket on this and a patch,
> > > > if you're willing.
> > > >
> > > > Regards,
> > >
> > > To be correct, the full code is (MouseToolbar.js:81) :
> > >         btn.events = new OpenLayers.Events(this, btn, null, true);
> > >         btn.events.register("mousedown", this, this.buttonDown);
> > >         btn.events.register("mouseup", this, this.buttonUp);
> > >         btn.events.register("dblclick", this, OpenLayers.Event.stop);
> > >         btn.action = id;
> > >         btn.title = title;
> > >         btn.alt = title;
> > >         btn.map = this.map;
> > >
> > > So it should be working ! But it is not, with my own configuration. I may
> > > be wrong ...
> >
> > Right you are. It doesn't work for me either. I don't know why, but it's
> > definitely not a new bug. I've just never bothered to look into it. If
> > you or anyone else were willing to, that would be great.
> >
> > Regards,
> Hi,
> 
> More informations about this problem. It seems the btn refers to a div 
> element ! In the HTML source I get :
> <div id="OpenLayers_Control_MouseToolbar_pan" style="position: absolute; left: 
> 5px; top: 308px; width: 28px; height: 28px;" title="Drag the map.">
> <img id="OpenLayers_Control_MouseToolbar_pan_innerImage" style="position: 
> relative; width: 28px; height: 28px;" src="js/img/panning-hand-on.png"/>
> </div
> 
> The img tag got no alt and title parameters. So the text we can see in IE come 
> from the div elements.

Ah, naturally. Our "images" are actually images-inside-divs: so, the
alt/title is on the wrong element. I don't know off the top of my head
the right way to fix this: I think that the btn has an 'img' property,
but perhaps we just use btn.firstChild to get to the actual image.  

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list