AccessibilitySnapshot icon indicating copy to clipboard operation
AccessibilitySnapshot copied to clipboard

Voice over description panel not recorded when using ScrollView - iOS 18.x

Open astwetteronline opened this issue 10 months ago • 3 comments

Similar to #33, with iOS 18.x the content of ScrollViews isn't detected correctly. Or am I missing something?

@Test
func scrollView_a11y() {
    let view = ScrollView {
        ForEach(0..<10, id: \.self) { _ in
            Text("Hello World")
        }
    }
    
    assertSnapshot(
        of: view,
        as: .accessibilityImage(
            size: CGSize(width: 375, height: 500),
            shouldRunInHostApplication: false
        )
    )
}

Image

astwetteronline avatar Jun 06 '25 09:06 astwetteronline

Hey @astwetteronline, does this work correctly if you run the test with a host application?

NickEntin avatar Jun 14 '25 01:06 NickEntin

@NickEntin Interesting. With the example project, it works totally fine (also without running it in a host application). We are using it in a Swift Package setup. Could it be related to that? I think it is not possible to run package tests in a host application, right?

astwetteronline avatar Jun 20 '25 08:06 astwetteronline

I am running into this same issue, where the accessibility panel does not show an item if said item is inside a ScrollView. With my project, I am also using a Swift Package setup and am running without host a application with the following test:

@Test
func accessibilitySnapshot() {
    let view = VStack {
        Text("hello, world!")
        ScrollView { Text("hello, again") }
    }

    assertSnapshot(of: view, as: .accessibilityImage(
        size: UIScreen.main.bounds.size,
        shouldRunInHostApplication: false)
    )
}

and I get the following result:

I have tried running that exact same test with a host application, and there is no issue (meaning "hello, again" is recognized in the panel). Unfortunately, I would only like to add accessibility tests outside of a host application. Is there any update for this issue?

qaa2990 avatar Dec 02 '25 20:12 qaa2990