My First Open Source Pull Request
I’ve been using open source software for as long as I can remember, but until now, I’d only ever been on the receiving end of it. I use these tools every day and get all the benefit, without ever contributing anything back.
That changed recently, almost by accident.
It started with a bug
I use LinearMouse to keep using my mouse even though its physical scroll wheel is basically dead, so Auto Scroll is a feature I lean on constantly. I noticed it wouldn’t activate if I started a middle-click drag directly over something clickable, a link, a thumbnail, a file icon in Finder. It only worked if I started the drag on empty space.
Normally I’d just file an issue and wait. This time I thought, why not actually try to fix it myself? So I opened PR #1340.
What I found
Digging into AutoScrollAccessibilityActivationClassifier, I found two separate problems bundled into the same code path:
- A hidden performance bug. Every single time Auto Scroll activated on a non-pressable element (which is the normal case), the classifier ran up to 9 extra synchronous accessibility hit-tests to resample nearby points, unconditionally. That resampling only exists to compensate for imprecise accessibility trees in browsers, but it was running everywhere, including native apps like Finder. It added roughly 600-900ms of perceptible lag before Auto Scroll kicked in. My fix restricted the resampling to actual web content, which brought Finder activation latency down from ~600-890ms to ~7-120ms.
- The actual reported bug. Auto Scroll never activates when the initial click lands on a pressable element, by design, ever since an earlier PR removed a similar toggle for being unreliable. I added an opt-in
activateOverPressableElementssetting (defaultfalse, so nothing changes out of the box) so people could choose to let Auto Scroll win over a link or button if they wanted to.
I tested it properly too: the full xcodebuild unit suite (537 tests), SwiftFormat and SwiftLint, and manual verification with log stream against a rebuilt app to confirm the actual latency numbers and that the opt-in setting behaved correctly in both states.
The outcome
My PR wasn’t merged as-is. The maintainer, Jiahao Lu, came back with a more targeted implementation in PR #1350: instead of restricting resampling, he replaced it with a single retry at the original click position, which handled the underlying browser accessibility-timing issue more precisely. The pressable-element part of the original issue ended up getting solved a different way too, through long-press activation in a separate PR, rather than my opt-in setting.
But the fix that shipped in commit 8b59f27 credits me as a co-author, and the commit message specifically thanks me “for identifying the unconditional AX resampling bottleneck, providing measurements, and proposing the original fix.” It also showed up in the v0.12.0-beta.4 release notes, listed alongside the maintainer’s name.
Why this made me happy
I use so much open source software, but this was the first time I actually landed a contribution back into one, even though none of my code shipped verbatim. What made it feel good wasn’t having the “correct” fix accepted as-is, it was digging in, measuring the actual problem, and having that work matter enough to shape what eventually got merged.
The lesson I’m taking from this: just start, even if what you ship isn’t the final answer. This make me wanna say “I want to do this again”.