Skip to content
Back to blog

Scaling for a sustainable path towards accessibility

Perfect is the enemy of good, and I learned it the hard way. In 2023, when I set up the Product Accessibility Working Group at GitLab, I wanted to find the best way to run automated accessibility tests for our product. It turned out that in a codebase as complex as GitLab's is, accessibility only holds up at scale, with layers of protection. The layers are both tools and people. None of the layers is perfect on its own, but together, they result in fewer regressions and better user experience.

Good intentions are not enough

As I was onboarding as a new Frontend Engineer, I wasn't sure what the state of things was. There were dedicated individuals working with accessibility in mind. There was an evolving design system that was supposed to guarantee a good baseline, a VPAT (Voluntary Product Accessibility Template) was prepared for every major version. However, it became clear to me that there wasn't any designated person or a team who knew the whole picture. We didn't have any guardrails or automations filtering incoming regressions. For a big open-core project with hundreds of engineers and community contributions, we didn't have a way to improve accessibility in a sustainable way. That is what moved me to take all steps necessary to have the Product Accessibility Working Group become a reality.

Choosing tools

The two main goals for our Working Group were tests targeting components of the design system and feature tests in the main application. But with an application as complex as GitLab, I had to first explore all the possible options for such automation. Tool exploration is definitely a topic in itself and a great material for another article. I focused on the limitations of each tool and how easy it was to set up and use. The design system repository and the main application repository were very different, but there had to be a common way of assessing accessibility violations.

We decided to use the axe-core testing engine, which is the most versatile. With axe-core, you can approach problems in many ways, like we did while testing our design system. Initially we opted for Cypress end-to-end tests with the cypress-axe plugin. Each component had to have test cases written for each variant and state to maximise the test coverage. Later on, we shifted towards a Storybook test-runner integrated with axe-core. Because having Storybook entries was in the definition of done for each component, we could take advantage of them and run the tests in a  CI (Continuous Integration) job without a need to write any test cases.

To speed up the adoption of automated tests in the main repository, I reviewed available paid tools that let you connect your entire test suite and run accessibility checks on each test. It seemed a promising solution, one that required only some time for initial setup to see the effects.

However, you should know your own limitations as well as your tools. For example, is your testing library supported by the provider you are considering? What is the volume of your tests? How often and in which context do they run? Ultimately, we decided to extend how we used open-source tools we had already been using, instead of introducing new ones.

Why the perfect test didn't fit

Feature tests sounded like a great idea for the application's monorepo, because they run against components from both HAML (HTML Abstraction Markup Language) and Vue.js files that made up the whole views of the application. We could then work around the lack of HAML tooling and some instances of elements composed in Ruby on Rails. Having feature tests would also make sure the integration of each design system component was tested. However, these tests are written around features and their functionality. There wasn’t an easy way to map how much of the UI is covered with them. Their loose structure also meant that one spec might exercise a single component, while another walks a flow across several views. In the end, some views were covered three times and others not at all.

The other complication was the variation in data samples and possible flakiness of tests. The feature tests are set up in a way, where the UI you test depends on the data each spec happens to create. To save on CI time, it often creates only the minimum information needed for the components to render. Which in turn further diminishes the coverage that is possible to achieve. a coupling of accessibility checks to functionality means that a failing test (flaky or not) might not reach the point when the accessibility check happens. It may simply never run. If any test case is quarantined, we lose our regression net.

These problems were compounded by the fact that the test output was disconnected from frontend components. Complex UI components that rendered into a series of general HTML elements made it harder to pinpoint where violations actually happened. Given that these feature tests were written in Ruby, but sat in a frontend toolkit, GitLab’s frontend engineers struggled to adopt them and make them a part of their usual workflow. Sure, the tool had its limits, but ultimately it did not fit how our teams worked.

After seeing a low adoption of feature tests, we decided to pivot to a different approach. By focusing on golden user journeys, we opted to cover end-to-end user workflows defined by Product Designers. This meant sacrificing the volume of components and their states we could cover. That's why, at the same time, we made sure to build a system of layers that would gradually filter out violations.

Layers that cover each other's gaps

The layers of accessibility automations can be divided along two dimensions: blind spots, and enforcement. They work together because blind spots of different layers overlap only partially. Layers that can be skipped are backed up by layers that can’t be. Some layers are optional (linting or the browser extension) or only observed (monitoring). Others are blocking: Storybook and feature tests run in CI and stop a merge when they find a violation.

Tool When to use Coverage Feedback timing Enforcement
linting while writing code JS, Vue, Markdown files real-time in editor optional
Storybook tests component development, feature development Vue components in isolation local testing and CI pipeline on frontend changes blocking in CI
feature tests feature development complete user journeys, HAML, Vue, JS components local testing and CI pipeline on frontend changes blocking in CI
browser extension feature development, code review & debugging any page or part of the page manual, immediate advisory
SiteSpeed monitoring production oversight key application pages continuous monitoring advisory
Source: Adapted from Accessibility. How our accessibility tools work together, GitLab Docs, with an added Enforcement column, licensed under CC BY-SA 4.0.

Here is how we used each of these layers, along with their limitations and advantages.

Linting offers the most immediate feedback to engineers, but it also comes with quite a number of limitations. Because it works against source code, not rendered HTML, the number of violations it can find is even lower than what other automations offer. In case of more custom syntax, like HAML, it also has limited tool options. In addition, design system components need to be mapped to HTML elements for axeLinter, the VS Code extension. From my experience, mapping may not be adaptable enough to cover more flexible components. We made it the default recommended extension for the project, but we had to accept not all contributors would use it. Nonetheless, I have seen real results with new merge requests and code reviews referencing the findings of axeLinter in VS Code.

Our Storybook layer consisted of two instances, one in the design system and the other in the app's monorepo. This made sure we catch any violations as early as possible and keep the output of the next bigger layer lean, because the feature tests didn’t have to rediscover component-level problems. We decided to additionally pair the accessibility plugin in the Storybook UI with a  test-runner with axe-core. This opened for us an option to automatically run checks on all components in CI. Fixing test violations allowed us to switch the CI job from "allowed to fail" to "completely blocking". It’s a great help for frontend engineers, but it also has its limitations. These tests can’t identify whether components are assembled into a section that is accessible as a whole. Also, if a design system is flexible enough, it can be hard to enforce that components are consumed in a way that is accessible; for example: not every property is used and those that are missing result in non-compliant code.

Our feature test layer meant we could follow the golden user journeys defined by the UX Department, and not the scenarios following the functional test suites. It gave us the option to cover complex UI interactions, with multi-step processes and dynamic content. Engineers could run them locally, while working on existing critical features. Feature tests can also run in the CI, blocking any newly found regressions. They can bridge the gap Storybook has - whether components put together and interactions between them create accessible pages and follow complex ARIA patterns. However, creating feature tests is a more elaborate process. It requires product-area knowledge. It is quite heavy on resources, like CI minutes or developers' time. It's not realistic to have a high coverage on this level, but the coverage you get is detailed and can run the checks after each scripted user interaction.

The axe DevTools browser extension is a great tool for quickly scanning the whole page or its section during development of new features or fixing violations. The extension highlights specific violations and their source and allows reviewers to share them as feedback on merge requests. Unfortunately, it is triggered manually, and we humans tend to forget things from time to time. Also, some of the features of axe DevTools are only available in the pro version. And with the free version, there is no way to track the adoption of the tool.

There are many options for setting up accessibility monitoring, from dedicated accessibility tools to observability solutions extended with the axe package. The best option for GitLab was a Sitespeed setup that the frontend department already used to monitor the app’s performance. I extended it with an axe plugin. That gave us additional data, about how specific pages were doing in terms of accessibility over time. Using Sitespeed opens the option of integrating with Grafana dashboards or Slack integrations. I find it to be a good option for the product managers, engineering managers and other roles that coordinate accessibility improvements, rather than engineers only. If your company has done a complete audit and you have results per page URL, you can easily measure the effects of remediation efforts over time with a monitoring tool like that. But keep in mind that it measures the results on a page load and misses any violations happening after user interactions.

The human layer

What all these layers of automations cannot do, is to see if the keyboard flow is right, what the experience is like with a screen reader or if the page makes sense as a whole. For that we need a person, to make sure we have the full picture. At GitLab, the human layer worked at three speeds: daily code reviews, one-off accessibility days, and building documentation and training over time. This level is the one that needs time and knowledge. It also occurs late in the process of development. This is why the automated layer is important, to lift some of that burden.

As a maintainer of the GitLab codebase, I saw how much code reviews can speed up the adoption of the tools, but also the awareness about digital accessibility. I made sure every time I left feedback, I backed it up with a recording from a screen reader, a link to documentation or WCAG criteria and with the explanation, how the problem in the code translates to what people experience and which users are affected. I was proud every time someone else mentioned my comments in another review of theirs. The feedback got documented and no longer depended on individual subject matter experts.

There is a lot of accessibility training out there and it might be hard to choose the right thing for you. In a company with an already excellent engineering culture, a basic training won't do much. The introductory training we provided didn't gain much traction from engineering, though it was a great hit with the other departments. A custom course with examples from real testers with disabilities made all the difference. Based on our automations and previous accessibility efforts, I was able to narrow down common patterns that needed more in-depth knowledge. Thanks to that, our course provider was able to build the curriculum around it.

The moment that glued all these pieces together was a dedicated accessibility day we organised, when team members spent a whole day on improving the accessibility of our product. We had designers, frontend and backend engineers contributing to previously triaged and selected issues. As a result, not only did our application improve, but so did open source projects we depend on. Our engineers contributed to their codebases, making sure those violations were gone. The 108 fixes from one such event resulted in improved components' patterns, additional documentation or complete component rewrites.

What worked, what didn't, what I'd do differently

The layered enforcement with Storybook in CI paired with the human aspects led to a clear improvement of the application's accessibility. Since then, regressions have been caught early. I also noticed that more teams were including accessibility considerations earlier in the process and I was asked more often about the feedback before features were built.

Looking back at the journey my Working Group took, I see that the hard part was staying in the experiment mindset. Narrowing the feature tests felt like giving up the perfect solution. That's why the exploration phase is very important, both in terms of discovering what is technically possible and which solutions teams will actually adopt.

If you’re starting from zero, begin by mapping layers of the product, tools and testing frameworks that are already used. This should be a guide to experimenting with different options and checking which solution fits.

Creating a system like this takes time and team effort, and so does staying accessible. One-off audits do not guarantee it, and in an ever-evolving system it's nearly impossible to reach the perfect state. But a series of imperfect guards and processes results in a sustainable path towards an accessible application. The good thing is that a system like that can be built over time. Even if you think you are starting from nothing, there's a high chance you already have a testing framework that can be extended to include accessibility checks.