Microsoft has made a significant investment in accessible web browsing, and you’ll be pleased to find that most of the controls make good decisions about accessibility right out of the box. Understanding how to use them for this purpose takes a little effort, however.
If you’re building websites for large enterprises or the government, Section 508 (an amendment to the Rehabilitation Act) makes this very important. Check out Accessibility for Everybody, by John Paul Mueller (Apress) for more information.
Most ASP.NET controls, where applicable, fit a certain feature list for accessibility. The goal is to make coding for accessibility easy for the programmer and functional for the user.- Any element that isn’t made of text should have an alternate text option. For instance, all image tags support an
AlternateText
property, which populates the HTMLalt
tag. web-to-text readers will “speak” the contents of this tag in place of the image. If you add an image to a web page, Visual Studio even prompts you for the alternate text. - Controls don’t require the use of style sheets or color dependency. If you want, you can easily strip all style information from a page for simplicity of use by a reader or a low-sight version of the application.
- All input controls in Getting Input from the User support a
TabIndex
property, which allows users to tab from control to control. For those not using a mouse, this is optimum. - Setting which part of the form has the cursor by default (called default focus) is easy in ASP.NET with the
DefaultFocus
property. Changing it is easy with theSetFocus
method. - You can give buttons keyboard equivalents by using the
AccessKey
property. - Labels and input controls can be associated, which many web readers depend on.