Wednesday, May 27, 2009

Accessibility: Empty text alternatives for ASP.NET image control

While building an accessible website you need to take into account that the following elements must have an ALT attribute:
  • img
  • area
  • input with type="image"
Why we need it?

The ALT attribute is designed to be an alternative text description for images.

What are the benefits?
  • Enhance the browsing experience of visitors with disabilities.
  • If somehow the image is not able to load, then a visitor will see the description of ALT attribute. This will also help when someone is using text based browsers like Lynx.
  • By having ALT attribute you are increasing the keyword density which is very good in terms of
    Search Engine Optimalisation (SEO).
What about decorative images?

The alt attribute for decorative images should be empty [alt=""] to meet the accessibility and XHML standards. If you include an empty alt attribute, screen readers will skip over the image. If you don't... the screenreader will read the entire URL of the image, which is quite annoying for the visitor.

What about the ASP.NET image control?

By default, when the AlternateText property is not set, the Image control does not include the alt attribute to specify the alternate text in the control rendering. If you set this attribute to be empty [AlternateText=""] you will notice that the control ignores it too.

Fortunately, since .NET 2.0, the image control contains a GenerateEmptyAlternateText property. It specifies whether or not the control creates an empty string as an alternate text. Set the GenerateEmptyAlternateText property to true to always include the alternate text attribute in rendered output for the Image control.

Thursday, May 7, 2009

Off-topic: Have you ever been to New York?

Take a look at that wonderful Aerial Virtual tour.
  • Turn on your speakers
  • Left below you'll find more views
  • Don't forget to enter the fullscreen
@TomPoint: Don't look at it.Within a couple weeks you'll see it in reality. :)