Incorrect sort order for SwiftUI Form in iOS 16
yonaskolb opened this issue · 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.
Hi @yonaskolb, thanks for reporting this! Can you provide a code sample that reproduces this issue? Additionally, what iOS version are you testing on?
Thanks for the quick reply @NickEntin. Example project showing the issue attached. I'm using iOS 16.4 in Xcode 14.3
SnapshotExample.zip
The example also highlights a different issue with the rendering of forms, which there is an unresolved issue for in SnapshotTesting pointfreeco/swift-snapshot-testing#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.
Any updates on this one?
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.
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](https://private-user-images.githubusercontent.com/1857549/252572318-b3453b5c-ee9e-46bd-a9b4-af6eeab55e1d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxOTI2MDgsIm5iZiI6MTcyNDE5MjMwOCwicGF0aCI6Ii8xODU3NTQ5LzI1MjU3MjMxOC1iMzQ1M2I1Yy1lZTllLTQ2YmQtYTliNC1hZjZlZWFiNTVlMWQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9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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.
Fixed by #169