r/Blazor • u/code-dispenser • 2d ago
Blazor: Accessible Components – What You Need to Know (Mini Rant)
TL;DR
- Accessibility is hard.
- You know practically nothing about the subject.
- You will never make anything that is accessible for everyone.
- If you go down this path, you will never reach the end.
- You will be constantly confused by contradictory articles on the same thing.
- Any automation or AI tooling only does part of the job. The rest you have to do manually.
There are plenty of other posts on Reddit that are far more interesting, so if you have zero interest in, or no need for, accessibility, do not waste your time with this very long post.
Still here? Then hopefully I can give you a few pointers on what is involved, so you at least know upfront what you are getting yourself into if you venture down this path. As a bonus, by the end you should be able to spot the BS accessibility claims made by the authors of vibe-coded component libraries, which are now appearing at an alarming rate.
Before I continue, I should point out that there are a couple of long-standing library authors who frequently post here. Despite any accessibility gaps their products may still have, I would always recommend working with such people over those whose libraries are just vibe-coded or jigsaws made from other people's work. With the former you get transparency, honesty about their components, and humans who actually know what they are doing and can both fix things and help if issues arise.
Automated checks
For automated checks and your CI you can use bUnit, axe-core and Playwright, with or without AI. I use axe-core with some components, but not all. I am a team of one and do a lot of manual testing, so my needs are different from those of a team of developers where some know nothing about accessibility.
Manual checks during development
Periodically check your work with browser extensions such as WebAIM WAVE or axe DevTools. There are many others; these are just my preferences.
During development you should also check your work using only your keyboard. In my opinion this is by far your best accessibility check, and it is where I find the most failures when looking at posted library components.
Voice control
That's the easy stuff out of the way. Now things get a little harder.
You should always test with voice control software, as it makes it much more obvious why on-screen text is the better option and ensures your controls have accessible names. On Windows you can use the free built-in Voice access, and on macOS you can use the free built-in Voice Control.
Screen readers
So far we have automated tests, keyboard-only checks and voice control software. Next comes screen reader (SR) and browser pairing tests, which is where most people put most of their effort. Please, please, please do not forget when doing SR checks that keyboard-only users who are not using a screen reader do not have access to the rich set of shortcut keys that screen readers offer.
Why pairings? Most screen readers have a preferred browser, so the bare minimum is to test each screen reader with its preferred browser. I recommend checking as many pairings as you can, given the bugs, quirks and nuances of the different combinations (more on that later).
If you do not know your target audience, the following is what I (and many others) consider a good screen reader test matrix:
- Windows: JAWS, NVDA and Narrator. I pair each of them with Edge, Chrome and Firefox.
- macOS: VoiceOver. As macOS is not my development machine, I only use Safari (sometimes Chrome). Those developing on a Mac may do more, as I do on Windows.
- iOS: VoiceOver with Safari. NB: VoiceOver on iOS is not the same as VoiceOver on macOS.
- Android: TalkBack with Chrome (sometimes I also use Edge).
Be warned: it will take you a few weeks to get comfortable using them all, and you will get confused because they can all behave differently on the same thing.
Windows screen readers have two main modes. One is for reading a page: browse mode in NVDA, the virtual cursor in JAWS and scan mode in Narrator. The other passes keys straight through to the page or component: focus mode in NVDA, forms mode (virtual cursor off) in JAWS, and scan mode switched off in Narrator. You can switch between them manually, and the screen reader will often switch automatically when you interact with widgets or form controls. VoiceOver and others do things slightly differently.
The term "widget" is both important and confusing when working with a screen reader. A widget is an interactive component such as a button, tab, slider or tree, and it has a matching ARIA widget role. For some screen readers, landing on a widget is a cue to switch from browse mode to focus/forms mode. Not all screen readers do this, which is why you will get confused (and I still do).
So what is this browse and focus business? When a screen reader is in browse mode, it intercepts (swallows) keys for its own use and does not pass them on to the application. When it is not in browse mode, it passes the keys through to the application or component.
This means you may be testing something with one screen reader and find that lots of keys work, but with another they do not. You then have to work out whether that is a bug in your code, a bug in that screen reader and browser pairing, or just how that screen reader works. As if that were not bad enough, you can also hit Blazor-specific issues, such as bugs that only appear with specific templates and their associated pre-rendering options (yet another screen reader bug filed).
How long does all this take?
That gives us a very high-level overview of what you need to do and what to expect. But how long is all this manual testing going to take?
I can only give rough figures. Honestly, I do not keep track of everything I do, as manual keyboard and screen reader checks while building and debugging components are now normal for me, just like pressing the play button and clicking around is for a lot of you reading this.
So, excluding the checks I do during debugging, what about a proper pass through the manual test matrix? That is one voice control tool, keyboard-only testing and six screen readers (let's not even try to calculate every browser pairing individually), so eight separate things to test per component. Let's say that, no matter how big or small the component, each test takes five minutes, including the time for different browsers, switching devices and so on. That is 40 minutes per component, bearing in mind that every bug found, patch release or new feature means spending another 40 minutes.
Now add Blazor's different render modes. I only do interactive, which really means the same tests on Interactive Server and Interactive WebAssembly (WASM). I skimp a little, so my time is about one hour per component (excluding time during development). If you add static server-side rendering (SSR), you are at about one hour 20 minutes per component.
So take these vibe-coded libraries. For 100 interactive components you are looking at at least 100 hours of skilled manual testing to start with. I build everything separately, so I can test in isolation. But if you have one big code base and change a lot of shared code, you may have to manually test many components again, per change.
100 hours is a full two and a half weeks of manual testing on a 40-hour week, and that assumes everything worked perfectly first time. If you find an issue, you have to fix it and run those manual tests again (albeit more quickly, because you can skip anything you know is not affected). I have seen libraries with even more components, as well as SSR support, and my estimate is that you should allow a full month to test all of them thoroughly.
Most vibe-coded libraries claim full WCAG 2.2 AA compliance and full keyboard support, and some also mention screen reader testing. They are built, with online sites, documentation and demos, in a few days, sometimes two or three weeks. Accessible?
When confronted, most of them crumble and say they have not finished testing yet, despite having put the component in the public domain with documentation stating that it is accessible. They usually have a page somewhere saying manual tests are in progress (which never get done; yes, I do go back and check some of them from time to time).
Anybody who does accessibility work will, if asked what they do and how, bore you stupid with the details, because they are proud of what they do and how they do it, and they do not shy away from such questions. Equally, nobody I know in the accessibility community would release a component into the public domain that has not been fully tested, let alone without manual testing, and then state in the documentation that it is fully accessible.
A real-life example
OK, I am starting to rant a bit. Let's get back on track with some real-life experience: me building a component over the last couple of weeks. My worst experience yet.
Luckily, I use screen readers during debugging sessions, so I found the problems early. It still cost me a week, but that is better than finding out at the end and doing a full rewrite.
Initially I wanted the component to use a non-modal popover dialog so that it would be in the top layer and save developers any z-index issues. It was all going great until I noticed that JAWS was not closing the dialog with the Escape key (in Edge or Chrome; it was fine in Firefox). I put that on the back burner, thinking I would add an Escape key handler later when I had got more done.
So I did more work, only to notice that NVDA was not announcing the correct state when the popover was open or closed (expanded or collapsed). At that point I thought I would manually add the aria-expanded state. I tried, and it failed. After more investigation, the only conclusion was a screen reader and browser bug.
I then thought I had better fix the JAWS issue before doing anything else, so I added an Escape key handler, only to find that JAWS was swallowing the Escape key, so the handler was useless. More time spent investigating led me to conclude that this was another JAWS and browser bug.
So my non-modal popover dialog was a no-go (generally you will not face the issue I faced with popover dialogs). That meant a slight redesign to use a modal dialog instead of a non-modal one, and I hit yet another bug, this time with Narrator, which refused to open the dialog if aria-haspopup="dialog" was present. At least I could work around that by using a different attribute.
So, one component and three verified bugs: JAWS paired with Chrome or Edge, NVDA paired with Edge, Chrome or Firefox, and Narrator paired with Chrome or Edge (it was fine with Firefox).
A slight change in design and a minor workaround ensured the same experience for screen reader users, and barring any other issues (I have not finished the component yet), I will be able to release another accessible component soon.
You can view those three bugs on the Chromium issue tracker (they were also filed with all the vendors concerned):
- JAWS: https://issues.chromium.org/issues/587468316
- Narrator: https://issues.chromium.org/issues/589824270
- NVDA: https://issues.chromium.org/issues/589797296
So has the author of that vibe-coded component library you are thinking of using done the appropriate checks, and then fixed the issues they found, so that the library is accessible?
And to the vibe coders creating libraries: no. Claiming accessibility and then adding statements such as "there are accessibility gaps", "this does not meet WCAG" or "screen reader testing is currently in progress" does not give you a pass and does not make your library accessible. It only shows your complete and utter ignorance if you put it in the public domain.
Paul



