GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

Voiceover cursor in TabView jumps to previous tab

Forums > SwiftUI

Hello,

When I run the following view on my iPhone with VoiceOver enabled, I encounter the following issue: I move the VoiceOver cursor to the dots for paging. I swipe up with one finger to go to the next page. The next page is displayed. But when the VoiceOver cursor jumps to the tab, the previous page appears again.

You can also see that the border of the VoiceOver cursor extends into the previous tab.

I suspect it has to do with the fact that despite the clipped modifier, the size of the image remains the same and extends into the previous tab.

Any idea how to fix this?

struct ContentView: View {
    var body: some View {
        VStack {
            TabView {
                ForEach(1..<6) { index in
                    Button(
                        action: { },
                        label: {
                            ZStack {
                                GeometryReader { geo in
                                    Image(systemName: "\(index).circle")
                                        .resizable()
                                        .scaledToFill()
                                        .frame(width: geo.size.width)
                                        .clipped()
                                }
                            }
                        }
                    )
                    .buttonStyle(PlainButtonStyle())
                    .padding([.bottom], 50)
                }
            }
            .tabViewStyle(PageTabViewStyle(indexDisplayMode: .always))
            .indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .always))
        }
        .padding()
    }
}

   

Hacking with Swift is sponsored by Essential Developer.

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until February 9th.

Click to save your free spot now

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.