AccessibilitySnapshot icon indicating copy to clipboard operation
AccessibilitySnapshot copied to clipboard

Incorrect sort order for SwiftUI Form in iOS 16

Open yonaskolb opened this issue 2 years ago • 7 comments

The order of parsed accessibility markers is in the wrong order. See screenshot, where the section headings are parsed as being at the bottom of the view. This is a SwiftUI view with no animations. Is there a workaround for this? The order is important to me as I use the accessibility markers to create a markdown representation of the view.

testExample MainA11y

yonaskolb avatar May 24 '23 01:05 yonaskolb

Hi @yonaskolb, thanks for reporting this! Can you provide a code sample that reproduces this issue? Additionally, what iOS version are you testing on?

NickEntin avatar May 24 '23 03:05 NickEntin

Thanks for the quick reply @NickEntin. Example project showing the issue attached. I'm using iOS 16.4 in Xcode 14.3 SnapshotExample.zip testExample Form

yonaskolb avatar May 24 '23 06:05 yonaskolb

The example also highlights a different issue with the rendering of forms, which there is an unresolved issue for in SnapshotTesting https://github.com/pointfreeco/swift-snapshot-testing/issues/667 If using drawHierarchyInKeyWindow: true in the example that issue is fixed but the rendering is offset incorrectly. Don't want to confuse the issue, just wanted to mention that too in case you're wondering why the snapshot looks weird.

testExample Form

yonaskolb avatar May 24 '23 06:05 yonaskolb

Any updates on this one?

yonaskolb avatar Jun 26 '23 13:06 yonaskolb

I haven't had a chance to test on Xcode 14.3 yet, but on Xcode 13.3 it seems to be behaving correctly. I'll dig in further this week.

NickEntin avatar Jul 03 '23 09:07 NickEntin

Still working on this one. There was definitely a change in iOS 16 that we're not currently handling properly. Looking at sample view you provided, in iOS 15 it's backed by a table view and in iOS 16 it's backed by a collection view.

iOS 15 iOS 16

It looks like with collection views it's using an accessibility container with a single element view (that's not an accessibility element) which then has subviews that are themselves accessibility containers each with a single element. Somewhere in this nesting we don't order things the same as VoiceOver.

NickEntin avatar Jul 11 '23 06:07 NickEntin

Fixed by https://github.com/cashapp/AccessibilitySnapshot/pull/169

yonaskolb avatar May 08 '24 02:05 yonaskolb