r/iOSProgramming • • 23m ago

Discussion Agent written SwiftUI keeps breaking accessibility and nobody notices

Our iOS app has a lot of older users, and accessibility matters for us, about 9% of sessions use VoiceOver or a large dynamic type size. Since agents started writing most new screens, our accessibility has been quietly getting worse.

What a blind user's email made us find last month:

- icon only buttons with no accessibility label, so VoiceOver reads "button"
- a custom card that groups 5 elements into one, so you can't reach the delete action
- text in fixed frames that gets cut off at larger type sizes
- a sheet that traps focus when it opens

coderabbit catches some of it in review, like an Image used as a button without a label. But reading order and what happens at the largest text size don't show up in a diff, and none of us test with VoiceOver on every PR.

What's helped so far:

- accessibility snapshot tests at 3 dynamic type sizes for our main screens
- a short accessibility section in the agent's instructions
- one person doing a 10 minute VoiceOver pass before each release

How do other iOS teams keep accessibility from slipping when agents write the UI? Anything automated that actually catches the VoiceOver problems?

3 Upvotes

2 comments sorted by

•

u/onefish857 12m ago

performAccessibilityAudit() in a ui test will catch a lot of the missing-label / contrast / hit-target stuff, it's been in xctest since ios 17. it still won't see a focus trap or a bad reading order though. for the card issue i'd just ban .accessibilityElement(children: .combine) on any container that has its own buttons, that's a very common agent habit.

•

u/Mediocre-Survey-5838 5m ago

The reading order and largest text size problems are the hard ones, because they only show up when someone actually moves through the screen. One thing that tends to help is a small set of XCUITests that walk your main flows, and since iOS 17 you can call performAccessibilityAudit() on the app inside those tests, which flags missing labels, clipped text and contrast issues without anyone opening VoiceOver. Running the same tests with the largest accessibility content size makes truncation fail loudly instead of quietly. I'd still keep your 10 minute human pass before each release, because an email from a blind user tells you things no tool will, but the automated part can take a lot of weight off it.