My take on how to improve the performance and accessibility of our website with React? (2) Accessibility
Tags: beginners, react, webdev, html
Published: 2023-12-09 04:03:40

The topic of creating a more accessible internet environment has been raised a lot more in recent years, especially in web development. Making web pages available to read for disabled people is almost a required skill for front-end engineers.
> ## How could we improve the accessibility of our website?

### **Use semantic HTML tags and add AIRA attributes**

By using HTML tags, the type of content that is highlighted would be read out by the screen readers. These are built-in features that are interactive elements with keyboard support. For example, <a>, <button>,<input type="type">, <select> are the most used ones.

Disabled people could use Tab and Shift + Tabnavigate through each element.

Basically, each element tag would have one or more of the following 4 properties:

* **type.** Describe its type such as a button, or an input area.

* **name.** Describe its name or title. Mostly, it is the computed label. If there is no title or placeholder attribute, we could use **AIRA attributes** such as aria-label and aria-labelledby.

* **value.** Usually associate with <input>. What the user has typed in the text field.

* **state. **For example, <select> can be expanded or collapsed.

### **Color and contrast accessibility**

Unlike sight-impaired people, some people may see things with low vision but have difficulty perceiving colors. Color and contrast accessibility are another important part we need to consider adding to our website.

The WebAIM guidelines give the following standards for developers to follow:
>  **Level A** is a basic requirement for some users with disabilities to be able to access and use web content.
>  **Level AA** indicates overall accessibility and removal of significant barriers to accessing content.
>  **Level AAA** provides improvements and enhancements to web accessibility for some users with disabilities.

**Typically, Level AA is the minimum recommendation with the following criteria:**

*The visual presentation of [text](https://www.w3.org/TR/WCAG21/#dfn-text) and [images of text](https://www.w3.org/TR/WCAG21/#dfn-images-of-text) has a [contrast ratio](https://www.w3.org/TR/WCAG21/#dfn-contrast-ratio) of at least 4.5:1, except for the following:*

* *Large Text*

[*Large-scale](https://www.w3.org/TR/WCAG21/#dfn-large-scale) text and images of large-scale text have a contrast ratio of at least 3:1;*

* *Incidental*

*Text or images of text that are part of an inactive [user interface component](https://www.w3.org/TR/WCAG21/#dfn-user-interface-components), that are [pure decoration](https://www.w3.org/TR/WCAG21/#dfn-pure-decoration), that are not visible to anyone, or that are part of a picture that contains significant other visual content, have no contrast requirement.*

* *Logotypes*

*Text that is part of a logo or brand name has no contrast requirement.*

These color and contrast ratio can be confusing since these are usually taking into account by the UI and UX engineers. But as front-end developers, playing a role in the web development process, we should at least know that what they are and how they work.

After putting these standards into practice, I tested my personal portfolio website with Google Lighthouse, and here is my result.

![result](https://cdn-images-1.medium.com/max/2000/1*SWaHYA3nZrdlBjtgWcOB2Q.png)

![passed audit details](https://cdn-images-1.medium.com/max/2000/1*uFJCZSy7jDZ9M9xz7785lQ.png)

![background and contrast ratio](https://cdn-images-1.medium.com/max/2000/1*32o3a8a4fiiUXCBVNTtvMw.png)

If we look through the report, I did pretty well on the naming and labeling part, but I still lack the experience in getting the correct contrast ratio correct. However, Google Lighthouse can guide me to improve the accessibility each time, and each time my accessibility score went up.

With these accessibility features, more people could access the endless web world. The developer community differs vastly from other working communities as it is friendly and inclusive, and it is one of the prior reasons why I chose front-end engineer as my career path. I hope that after reading this article, more developers will understand the importance of making our website more accessible to the disabled community.

Let’s connect:

[Portfolio](https://anthonyzhang.netlify.app/) | [Github](https://github.com/AnthonyZhang220) | [Medium](https://medium.com/@anthonyzhang220)| [LinkedIn](https://www.linkedin.com/in/anthony-xiangyu-zhang/)


![Happy Coding](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o41qdqsxj76jkmqe17dc.png)

{% cta https://www.w3.org/WAI/fundamentals/accessibility-intro/ %} Introduction to Web Accessibility {% endcta %}

{% cta https://webaim.org/standards/wcag/ %} Web Content Accessibility Guidelines {% endcta %}