Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Navigation and accessibility #376

Open
2 tasks done
honkmaster opened this issue Oct 10, 2023 · 1 comment
Open
2 tasks done

Issue with Navigation and accessibility #376

honkmaster opened this issue Oct 10, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@honkmaster
Copy link

honkmaster commented Oct 10, 2023

Description

I have an app with the basic structure of a NavigationView which contains a ScrollView. If the user taps an element in the ScrollView, the app navigates to a detail view. The ScrollView is modified using Introspect (v. 1.1.0). Additionally, the ScrollView has set some accessibility attributes to be used in XCUITests. Here is an example of the code.

ScrollView(.horizontal, showsIndicators: false) {
    content
      .accessibilityIdentifier("Bar")
}
.introspect(.scrollView, on: .iOS(.v16, .v17)) { scrollView in
    pagedScrollViewDelegator.width = geometry.size.width + spacing

    scrollView.decelerationRate = .fast
    scrollView.clipsToBounds = false
    scrollView.alwaysBounceVertical = false
    scrollView.delegate = pagedScrollViewDelegator
}
.accessibilityElement(children: .contain)
.accessibilityIdentifier("Foo")

Now there is a problem in the XCUI tests. When the app starts for the first time, all accessibility identifier are set correctly. XCUITests can navigate. But when the tests comes back to the start page, all accessibility identifier inside the modified ScrollView are gone from the hierarchy. If we remove the modification of the ScrollView with Introspect, the test works, the identifier remain even after navigation.

Checklist

Expected behavior

Accessibility accessibility should remain

Actual behavior

Accessibility accessibility are gone after navigation

Steps to reproduce

See above.

Version information

1.1.0

Destination operating system

16.4

Xcode version information

Xcode 15.0

Swift Compiler version information

No response

@honkmaster honkmaster added the bug Something isn't working label Oct 10, 2023
@honkmaster
Copy link
Author

Note:

If I move the accessibility view modifiers from after to before the introspect view modifier the XCUITests seem to continue to work (short debugging). However, this might be a workaround, but should not be required as it is non deterministic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant