Web Accessibility – How to Check – Aspose.HTML for .NET
What is Web Accessibility?
Web accessibility refers to designing and developing websites, applications, and digital content to ensure they are accessible to all people, including people with disabilities. Improving your product’s accessibility can enhance the usability for all users, including those with low vision, blindness, hearing, cognitive, motor, or situational disabilities (such as a broken arm). The goal of web accessibility is to remove barriers that may prevent disabled persons and all other people with disabilities from accessing and effectively interacting with online content. Test whether or not your website is WCAG compliant!
How to Check Accessibility of Website
This chapter offers a detailed guide on validating an HTML document according to WCAG compliance. Aspose.HTML for .NET API provides the Aspose.Html.Dom.Accessibility namespace that is for all web accessibility-related manipulations and complies with international standards W3C Web Accessibility Initiative.
This chapter introduces articles with recommendations that are based on WCAG requirements to help you get started writing web content that is more accessible to people with disabilities. Find out if your website is WCAG compliant!
This chapter includes the following pages:
- Web Accessibility Check – Learn how to check website accessibility for all WCAG compliance or only meet specific criteria using classes and methods of the Aspose.Html.Accessibility and Aspose.Html.Accessibility.Results namespaces.
- How to Improve Website Accessibility – In this article, you will learn how to make your website accessible to users and how to check the website for compliance with WCAG guidelines using Aspose.HTML for .NET API.
- Screen Reader Accessibility – You will learn how to design your website for screen reader accessibility and how to check alternative text for screen readers against WCAG guidelines using Aspose.HTML for .NET API.
- Сolor Сontrast Accessibility – We will discuss color and proper contrast according to WCAG, the world’s authority on web accessibility. You learn how to check color contrast accessibility using C# and make your web content easy to read for all users.
- Multimedia Accessibility – Learn how to make multimedia content inclusive and accessible to a broader audience, including people with disabilities. This article contains C# examples to check multimedia accessibility best practices according to WCAG standards.
Let’s see a code snippet related to web accessibility validation. The C# code snippet demonstrates the basic steps for creating a validator, loading an HTML document, and validating it for web accessibility compliance:
- Use the WebAccessibility() constructor to create an instance of the WebAccessibility class responsible for web accessibility validation.
- Call the CreateValidator() method to create a validator object.
- Load an HTML document using one of the HTMLDocument() constructors.
- Use the
Validate(
document
) method to check the HTML document for accessibility. The result is stored in theresult
variable. - Check whether the validation was successful. For each accessibility issue, print information about the rule code, rule description, and whether the validation succeeded or failed.
1// Initialize a webAccessibility container
2var webAccessibility = new WebAccessibility();
3
4// Create an accessibility validator
5AccessibilityValidator validator = webAccessibility.CreateValidator();
6
7// Prepare a path to a source HTML file
8string documentPath = Path.Combine(DataDir, "test-checker.html");
9
10// Initialize an HTMLDocument object
11using (var document = new HTMLDocument(documentPath))
12{
13 // Check the document
14 var result = validator.Validate(document);
15
16 // Checking for success
17 if (!result.Success)
18 {
19 foreach (var detail in result.Details)
20 {
21 // ... do the analysis here...
22 Console.WriteLine("{0}:{1} = {2}", detail.Rule.Code, detail.Rule.Description, detail.Success);
23 }
24 }
25}
Why is Web Accessibility Important
The Web is an increasingly important resource in many aspects of people’s lives, such as education, commerce, health care, employment, recreation, and more. Thus, the Web must be accessible for everybody to provide equal access and opportunity to people with diverse abilities. Access to information and communication technologies is defined as a fundamental human right by the United Nations Convention on the Rights of Persons with Disabilities.
According to the World Health Organization’s 2011 World Disability Report, 15% of the world’s population has some form of disability, and the number of people with disabilities is steadily increasing. Web accessibility is crucial for several reasons, many of which touch society’s social, economic, and legal fabric.
Here are some more website accessibility statistics. It clearly demonstrates the inability of most online resources to accept people with special needs into their digital world:
- 54% of adults with disabilities go online.
- 90% of websites are inaccessible to people with disabilities who rely on assistive technology.
- 71% of customers with disabilities have difficulty using the site and will be forced to leave it.
- 82% of people needing access would spend more money online if websites were more accessible.
Web accessibility is a legal requirement in many countries, and a moral and ethical responsibility to ensure that the digital world is inclusive and accessible to everyone, regardless of their abilities or disabilities. In many countries, including the United States, with the ADA (Americans with Disabilities Act) and Section 508, some laws and regulations require websites and digital content to be accessible to people with disabilities. The EU has legislated to support the rights of persons with disabilities. Non-compliance can lead to legal consequences and fines. Web accessibility reflects the desire to treat everyone respectfully and give the same rights and opportunities to access information and services. It’s not just a technical requirement; it’s a fundamental aspect of creating an inclusive and equitable online environment.
Accessibility and SEO
Many web accessibility practices align with best search engine optimization (SEO) practices. This means accessible websites are more likely to rank higher in search engine results, potentially increasing their visibility and reach. Demonstrating a commitment to accessibility can enhance your organization’s reputation. It shows that you value diversity and inclusion and are willing to invest in creating an accessible digital environment. By making your website accessible, you show your visitors and customers that you value and care about them as individuals, and in turn, this investment will increase your brand loyalty and popularity.
Search engines consider web accessibility as a ranking factor. Detecting and addressing accessibility errors can have a positive impact on SEO, potentially improving a website’s visibility in search engine results. Most approaches that improve website accessibility also improve the website’s usability for all people, not just people with disabilities. Here are just a few examples of where SEO and accessibility can intersect:
- Semantic HTML, title tags, heading tags H1, H2, etc.
alt
attribute in img tag, button alt text- Video transcription and audio description
- Text size and color contrast
- Link anchor text
- Sitemaps, table of contents, and breadcrumbs on the site
Web Accessibility Standards
Web accessibility is a moral and ethical responsibility to ensure that the digital world is inclusive and accessible to everyone, regardless of their abilities or disabilities. Here are some of the most well-known accessibility standards and guidelines:
- WCAG (Web Content Accessibility Guidelines) provides a set of standards and guidelines for creating accessible web content and is widely used as a reference in the industry.
- Section 508 is a U.S. federal law that mandates accessibility standards for federal agencies’ electronic and information technology. These standards ensure that federal websites and digital services are accessible to people with disabilities.
- EN 301 549 is a European standard that defines accessibility requirements for ICT products and services, including websites and software. It aligns with WCAG and includes additional European-specific requirements.
- While ARIA is not a standard in itself, it is a set of technical specifications published by the W3C that provide additional information about the accessibility of assistive technologies. It is often used in conjunction with other standards, such as WCAG.
Fundamental principles of web accessibility include Perceivability, Operability, Understandability, and Robustness. This means that all visitors must be able to perceive and be aware of the content and information presented on your website. Content and navigation should be clear and easy to understand. Websites should be operable using various input methods, such as keyboard navigation, voice commands, or assistive technologies like screen readers.
Web accessibility is a legal requirement in many countries:
- In the United States, under the Americans with Disabilities Act (ADA) and Section 508, certain laws and regulations require websites and digital content to be accessible to people with disabilities.
- The EU has passed laws supporting the rights of people with disabilities. Failure to comply may result in legal consequences and fines.
- In Australia, this is the Disability Discrimination Act.
- In Germany, this is the Federal Regulation on barrier-free information technology, etc.