[OpenLayers-Users] OpenLayers accessibility

christopher.schmidt at nokia.com christopher.schmidt at nokia.com
Fri Aug 20 18:27:56 EDT 2010


On Aug 20, 2010, at 4:40 PM, ext William Martin wrote:

> All,
> 
> Is there any way, short of rolling a custom variant, to make OpenLayers add ALT text to its images?

There's nothing like this currently. However, you could probably achieve this
by modifying OpenLayers.Util.createImage and OpenLayers.Util.createAlphaImageDiv,
modifying them to set the alt attribute; this code is used for almost all
image creation in the library, so I expect this would resolve most of the
cases.

-- Chris

> Currently the tile images I'm getting are added something like this:
> 
> <img 
>   style="width: 256px; height: 256px; position: relative;" 
>   src="{URL snipped}" 
>   class="olTileImage" 
>   id="OpenLayersDiv2089">
> 
> When my screen reader encounters that, it reads the URL for the image, which is:
> 
> http://opencache.statkart.no/gatekeeper/gk/gk.open?LAYERS=topo2&amp;FORMAT=image%2Fjpeg&amp;SERVICE=WMS&amp;VERSION=1.1.1&amp;REQUEST=GetMap&amp;STYLES=&amp;EXCEPTIONS=application%2Fvnd.ogc.se_inimage&amp;SRS=EPSG%3A4326&amp;BBOX=0,56.25,11.25,67.5&amp;WIDTH=256&amp;HEIGHT=256
> 
> Keep in mind that it's reading this aloud, so somethin like "1.25" comes out as "one point two five".  Multiply that pain by 34 for the initially loaded tiles.
> 
> Then the map controls have HTML like this:
> 
> <img 
>   id="OpenLayers.Control.PanZoomBar_2159_panup_innerImage" 
>   style="position: relative; width: 18px; height: 18px;"
>   src="http://openlayers.org/api/img/north-mini.png">
> 
> Again, a screen reader reads the contents of the SRC attribute because there's no ALT text.
> 
> Maps are inherently visual/spatial, and therefore of little use to a blind visitor.  I'd like to set blank ALT text on all the images, thus:
> 
> <img 
>   style="width: 256px; height: 256px; position: relative;" 
>   src="{URL snipped}" 
>   class="olTileImage" 
>   id="OpenLayersDiv2089"
>   alt="">
> 
> ... which will cause screen readers to silently skip over the image.  Then I'd add ALT text for the entire map:
> 
> <div id="access-note">Image: Map of Norway.</div>
> <div id="map">{OpenLayers would fill in the map here}</div>
> 
> That way, any blind visitors would be told that there's a map of Norway there, but not troubled with endless, mindless recitations of image SRC attributes for a map they can't use.  All of my site's content is actually available without the maps -- the maps are a useful navigational interface, but all the actual site content can be read without them.
> 
> So, can I make it add blank ALT text to the tile and control images?
> 
> Will Martin
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list