- Published on
Working on Chromium: Investigating and Fixing Accessibility Bugs
- Authors
- Name
- @atbrakhi
I have been working on Chromium for the last couple of months. And I am having fun.
Earlier this summer, I was asked if I could help fix some accessibility bugs in Chromium. I was working on Servo at the time. I wasn’t sure how the move from Servo to Chromium, and from Rust to C++, would feel, but I was curious. As an engineer working on rendering engine and so closely with browsers, I think it’s always useful to understand how different engines and the systems built around them work.
Not long ago, I realised something. I have been working in tech for eight years, but I have rarely spent this much of my time focused on investigating and fixing bugs. Most of my work has involved building systems or adding features. On Servo, that included working on the minibrowser and building out Servo DevTools from its early stages. Building those things also involved fixing plenty of bugs. But on Chromium, investigating and fixing bugs has been the main work since day one. I have been enjoying having that focused time for the investigation itself.
The first bug involved a text area. With the caret inside the second line, Chromium told the macOS Accessibility API that it was on the third line. Ask for the range of that line, and Chromium returned nothing.
I compared the behaviour with Safari and added a regression test covering both API calls. The two incorrect answers came from separate issues in the implementation. The line lookup needed to find the line containing the text index, rather than return the position of the next line start. There was also a restriction elsewhere that only allowed line zero when returning a line’s range.
The final patch was small. I wrote about the full investigation in How C++ lower_bound caused a browser accessibility bug.
Since then, I have spent quite a bit of time figuring out why VoiceOver is announcing things it shouldn’t. And I can tell you already, VoiceOver itself wasn’t the problem in these cases..
In one case, it was announcing an extra “group” for a list item. Chromium was taking a name from the item’s contents and exposing it as the group’s title.
Removing the title would stop the extra announcement, but list items can also have names explicitly supplied by the author. Those needed to stay. The fix had to account for where the name came from, so we could suppress the content-derived title while preserving an author-provided name.
Then there was another bug where VoiceOver repeated column headers while navigating a table.
Chromium provides the column headers associated with a cell. When the cell was itself a column header, it included itself in that collection. VoiceOver announced the current cell and then encountered the same object again among its associated headers.
Excluding the object itself fixed that. I also checked the corresponding row-header code, which had the same problem. That became another report and fix. The row-header behaviour existed in two parallel Cocoa implementations, so both needed updating.
You know, the typical engineering experience. You were fixing one bug, and now you have more bugs.
I have been enjoying following those connections, especially when looking into one bug leads me to another. The column-header report gave me a specific behaviour to investigate. Once the cause of the column-header bug was clear, I wanted to check the row-header implementation and found the same problem there. That meant another report and more code to fix than the original bug had suggested, which gave me another cool opportunity to follow the bug through the code.
There have been highs and lows over these last couple of months, of course—including not being able to reproduce a reported bug in the first place. I have also had the excitement of finding the cause of a bug and getting the fix in place, with related issues giving me more to investigate along the way. Isn’t this what we programmers call an adventure?
I have spent most of my career building systems and adding features, and I already knew I loved that work. Working on Chromium has given me much more time to stay with the investigations themselves, including following a finding into related code. I hadn’t expected to enjoy having that as the main focus of my work quite this much. Good to know now!