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:

  1. Use the WebAccessibility() constructor to create an instance of the WebAccessibility class responsible for web accessibility validation.
  2. Call the CreateValidator() method to create a validator object. The ValidationBuilder.All argument suggests that you want to perform all available accessibility validations.
  3. Load an HTML document using one of the HTMLDocument() constructors.
  4. Use the Validate(document) method to check the HTML document for accessibility. The result is stored in the validationResult variable.
  5. 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.
 1using Aspose.Html;
 2using Aspose.Html.Accessibility;
 3using Aspose.Html.Accessibility.Results;
 4using System.IO;
 5...
 6    // Initialize webAccessibility container
 7    var webAccessibility = new WebAccessibility();
 8    
 9    // Create an accessibility validator with a static instance for all rules from repository that match the builder settings
10    var validator = webAccessibility.CreateValidator(ValidationBuilder.All);
11	
12    // Initialize an object of HTMLDocument class
13    using (var document = new Aspose.Html.HTMLDocument("index.html"))
14    {
15        // Check the document
16        ValidationResult validationResult = validator.Validate(document);
17
18        // Checking for success
19        if (!validationResult.Success)
20        {
21	        // Get a list of Details
22            foreach (var detail in validationResult.Details)
23            {
24                Console.WriteLine("{0}:{1} = {2}", detail.Rule.Code, detail.Rule.Description, detail.Success);
25            }
26        }
27	}

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:

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:

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:

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:

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.