Creating a Web That Works for Everyone
At first glance, web accessibility seems simple – just make sure a website can be used by everyone. Look closer, though, and plenty of challenges emerge. Find out why ensuring that everyone can access websites matters so much.
At first glance, web accessibility seems simple – just make sure a website can be used by everyone. Look closer, though, and you will find a rich tapestry that weaves ethics, legal compliance and technical challenges together.
Let’s go through a few kinds of disabilities to get a better sense of how they can affect the way people use websites, and why it matters so much that everyone can access them.
Web Accessibility Across Different Abilities
Disabilities cover a wide spectrum, and this article cannot realistically address every one of them. Still, it is worth knowing a few key examples to understand how they affect a person’s ability to use the web.
A disability may be permanent or temporary and can affect someone’s visual, motor, auditory or cognitive abilities. A person with a visual impairment, for example, may live with color blindness or macular degeneration; someone with a mobility impairment may find it hard to use conventional input devices; and people with cognitive impairments may have difficulty processing information.
Every type of impairment calls for different accommodations on a website. Users with mobility impairments, for instance, may have to navigate a page using nothing but a keyboard. People with visual impairments, on the other hand, may need high-contrast text and images to be able to see them. And individuals with cognitive impairments frequently benefit from predictable designs and text that is easy to understand.
It is vital to be aware of the different ways users may perceive and interact with your product. Most people may navigate websites with a mouse by default, but others depend on alternatives such as screen reader applications.
Bear in mind, too, that anyone can be affected by a temporary disability at any moment, like a broken arm or lost glasses. In situations like these, the way someone uses the web may change for a while.
An Investment, Not an Expense
Building accessibility into our products is key to reaching a wider audience. According to estimates by the World Health Organization (WHO), roughly 15% of people worldwide live with some kind of disability. Neglecting accessibility (a11y) may mean missing out on a considerable share of the market.
In some situations, an accessible website is a legal requirement. The European Accessibility Act, for instance, obliges public organisations and certain private companies, such as banks and transports, to make their websites usable by everyone.
Many people believe that building accessibility into a product is costly and demands additional resources. In reality, the true cost lies in adding accessibility to a product that is already finished. Once the design is locked and development is nearly complete, trying to add accessibility can take a lot of time and may call for major changes, like improving color contrasts that fall short of the standards or reworking navigation for keyboard-only users. Fixing accessibility at a late stage frequently means the whole project team has to get involved all over again.
This additional work and cost, however, can be cut considerably by approaching accessibility proactively. Keeping costs under control is possible when accessibility is taken into account from the very beginning of a project and designs are checked against accessibility guidelines before development starts. Developers can then build accessibility features in parallel with the other business requirements.
Accessibility can be compared to an elevator in a building: it may raise the initial construction costs, and fitting it after the building is finished costs even more. Once installed, though, it helps not only people who cannot take the stairs but makes life easier for everyone in the building.
Building Accessibility into Your Workflow: Automated Tools and Best Practices
When everyone agrees on why accessibility matters and we have appealing, carefully crafted designs that follow best practices, we can begin building the actual product.
An easy first move towards accessibility is adding automated tools that scan our code for possible accessibility problems. I like to combine tools, namely the ESLint plugin ESLint-plugin-jsx-a11y and the Axe accessibility testing tool Axe-core for React. They help spot typical accessibility problems early on in development.
ESLint a11y plugin
Setting up this linter is very easy. Just install the package and add it to your .eslintrc.cjs configuration file. In most cases, I find the recommended settings sufficient. If necessary, you can readily tailor it to your needs by changing the severity levels of the error messages.
With the plugin enabled, it helps you spot accessibility problems early. It integrates smoothly with Visual Studio Code, where it shows detailed error messages – warning you, for instance, when an image tag lacks an alt attribute.
Screenshot of an example linter error message
Axe by Deque
The Axe tool is just as easy to install and set up. Once installed, it has to be enabled in the mainReact file. Remember to turn it off in production mode.
Axe-core only works in Chrome and Firefox. Its reports can be viewed simply by opening the developer console in your browser.
Example of an axe-core warning message
The tool not only points out exactly which element in the DOM tree is causing the issue, but also provides a link to Deque University. There, you can look up a thorough explanation of the issue and a possible fix.
Lighthouse
Lighthouse, well known for its web performance reports, can also assess how accessible a webpage is.
Accessibility score in Lighthouse
CLI
Audits with Axe-core and Lighthouse can also be run from the command line interface. Combining these checks with a linter and adding them to your CI/CD pipeline gives you a strong foundation for avoiding accidentally pushing code that violates accessibility guidelines.
Browser native a11y tools
Automated tools are useful, yet they detect only some of the possible accessibility issues on your site. We need to get our hands dirty and verify ourselves that everything complies with accessibility standards.
Chrome and Firefox both provide accessibility testing tools, and neither is better than the other. In my view, they complement each other and are best used together.
Accessibility Tree
The Accessibility Tree is a structure resembling the DOM. It conveys the semantics of the content – only what it means, not how it looks. Assistive devices and software, screen readers among them, rely on this structure to tell users what a web page contains and how they can interact with it.
Screenshot of a website alongside its accessibility tree
When building websites, we need to make sure our code is correctly reflected in the accessibility tree. This matters because content missing from the Accessibility Tree can be difficult to reach for people who use assistive technology, preventing them from fully accessing the site’s information and features.
Vision deficiency emulator
Firefox and Chrome both include a great tool that emulates various vision impairments. It shows us what a website looks like to people with color vision deficiencies such as Deuteranopia, and also to those with blurred vision or low contrast vision.
Screenshot of emulated blurred vision
Screenshot of emulated reduced contrast
Of course, this only approximates how someone with such a vision impairment may see websites, so treat it as a first checkpoint.
Contrast ratio shown in the Chrome element inspector
The Chrome element inspector lets us check the contrast ratio. The Chrome colour picker can even propose colours that keep the contrast ratio at the required level.
Tabbing Order
Firefox has another extremely handy feature, the Tabbing Order, which can be turned on in the developer tools.
Example of the tabbing order on a simple website
Once enabled, this tool shows the order in which focus moves as you press the Tab key. Making sure that this order is logical is crucial for letting users reach every clickable element on the website. A correct order makes things better not only for people unable to use a mouse, but also for those who simply find a keyboard more practical.
Practical tips
In my opinion, navigation and forms deserve special attention when it comes to proper accessibility. Both matter a great deal because users engage with them constantly – navigation is used all the time, and forms are what let users carry out various tasks on a website.
Form without labels
Form with invisible labels
The sign-up form shown here looks elegant, with a clean, minimalist design that doesn’t overwhelm users with unnecessary information. Using placeholders in place of labels, however, may cause problems for people who rely on screen readers.
Because placeholders vanish as soon as an input field is filled in, people with cognitive impairments may find it hard to remember what each field is for. On top of that, this approach can cause trouble even for users without disabilities, potentially leading to confusion and fatigue, especially in long and complicated forms.
Form with proper labels
A far better solution is to put labels right in the form. This makes it more predictable and keeps the context available at all times. Required fields carry an asterisk. Remember to hide the asterisks from screen readers with the aria-hidden property, and to use aria-required to flag a field as required for assistive technologies. Designs like this help every user, whatever their abilities. When users can easily check what a field requires while typing, the cognitive load drops considerably.
Remember that this covers only a small part of the best practices for building forms. I suggest exploring the topic further to learn where validation messages should go and how they should change in response to user interactions.
Semantic HTML elements
As web developers, we are able to make a div look and behave like a button, even a highly sophisticated one. That doesn’t mean we ought to. A semantically correct DOM is easier to use for people relying on assistive technologies. So it’s best to stay with the good old <button> and to use tags such as <main>, <footer> or <nav> .
QA & Feedback
Finally, accessibility checks absolutely need to be part of the quality assurance phase. Manual testers should verify how the page works and looks when assistive technologies are in use.
Lastly, we should proactively ask for feedback from users who mainly use our products through assistive devices. Making sure their experience is smooth, with no barriers or pain points, is crucial for genuine accessibility.
Summary
Web accessibility is about more than the simple idea of making a website usable for everyone. It combines ethical responsibility, legal requirements and technical challenges. Disabilities differ enormously in their nature and effects, influencing how various users navigate and understand web content, and each comes with its own needs. Approaching accessibility proactively not only broadens your audience but can also cut costs and improve the experience for all.
Resources and further reading
W3Cx: Introduction to Web Accessibility on edX
W3C Web Accessibility Initiative (WAI) home page