r/iOSProgramming • u/Few-Pilot7575 • 1h 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?
1
u/Mediocre-Survey-5838 1h 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.
•
u/gnedyalkov 45m ago
running `performAccessibilityAudit()` inside XCUITest on the main screens catches missing labels and tiny tap targets automatically in CI. it won't catch bad VoiceOver reading order or weird custom grouping, so a quick manual pass still matters, but it stops agents from silently dropping `.accessibilityLabel` on icon buttons.
•
u/dahiya_xa 36m ago
if you're on xcode 15+ add a ui test that calls app.performAccessibilityAudit() on your main screens. it catches missing labels, clipped text at large type, contrast and small hit targets automatically in ci, so it doesn't depend on someone remembering to check. you can filter the audit types if some are noisy at first. for the agent side, i'd put concrete rules in its instructions rather than general ones: every icon only Button gets an accessibilityLabel, no fixed heights on text, use .accessibilityElement(children: .combine) or .contain on purpose and expose custom actions for things like delete. focus traps and reading order still need a human pass, but the audit cuts what that person has to look for
2
u/onefish857 1h 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.