Making Sure Your ASP.NET Site Is Accessible
Everyone has special needs, and those needs change as time progresses. Microsoft is aware of this. Someone with perfect eyesight in the morning might suffer from tired eyes in the afternoon. Many web users have some sort of special need all the time. Whether the need is intermittent or constant, making your site accessible means making it easy for everyone to use.
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
AlternateTextproperty, which populates the HTML
alttag. 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
TabIndexproperty, 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
DefaultFocusproperty. Changing it is easy with the
- You can give buttons keyboard equivalents by using the
- Labels and input controls can be associated, which many web readers depend on.
A feature in Visual Studio called Check Page for Accessibility checks web Content Accessibility Guidelines (WCAG) and Section 508 errors. If you use this feature, warnings will actually be posted to your build process.