TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

TabView ScrollView and Accessibility issues

Forums > SwiftUI

Hi All,

I have just come across a very random issue that I hope one of your kind selves might be able to help me with.

In a nutshell I have a TabView containing two tabs, one is ScrollView of buttons and one is a List of buttons, the problem is when I use the VoiceOver option to test for accessibility issues the list in the first tap will only scroll when first displayed/used, if I navigate to the second tab and come back to the first I can no longer click on any buttons in the ScrollView or scroll using three fingers.

I have tested the Shortcuts app and that seems to work fine, below is a simple mock-up of the issue, please give it a try and if you can help it would be greatly appreciated as I don't want to ship an app if its fundamentally broken.

Many Thanks, Nigel

struct TabViewSUI: View {
    var body: some View {
        TabView {
            ForView()
                .tabItem { Text("Test") }

            Text("Test View")
                .tabItem { Text("Test View") }
        }
    }
}

struct ForView: View {
    var body: some View {
        NavigationView {
            ScrollView(.vertical) {
                ForEach(1..<100) { i in
                    Button {
                        print("Test")
                    } label: {
                        Rectangle()
                            .fill(Color.red)
                            .frame(height: 40)
                            .overlay {
                                Text(String(i))
                                    .foregroundStyle(Color.white)
                            }
                    }
                }
            }
            .accessibilityAction(.default) {
                print("Test")
            }
            .navigationTitle("Test")
        }
    }
}

2      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.