why ToolbarItemGroup appears only on the first tab?

// just check the below code. it's about simplest possible to // looks the same with simulator and real device with iOS 17.1+

import SwiftUI

struct MainTabView: View {
    @FocusState private var focusedField: Bool
    
    var body: some View {
        TabView {
            TextField("test 1", text: .constant("test 1"))
                .focused($focusedField)
                .tabItem {
                    Label("tab 1", systemImage: "number")
                }
                .toolbar {
                    ToolbarItemGroup(placement: .keyboard) {
                        Button("Done") { focusedField = false }
                    }
                }
            
            Text("test 2")
                .tabItem {
                    Label("Home", systemImage: "house")
                }
            
            TextField("test 3", text: .constant("test 3"))
                .focused($focusedField)
                .tabItem {
                    Label("tab 3", systemImage: "number")
                }
                .toolbar {
                    ToolbarItemGroup(placement: .keyboard) {
                        Button("Done") { focusedField = false }
                    }
                }
        }
        .tint(.primary)
    }
}

@main
struct MainApp: App {
    var body: some Scene {
        WindowGroup {
            MainTabView()
        }
    }
}

Answered by DTS Engineer in 800572022

Thanks for flagging this out. I was able to reproduce the issue on my end as well and this seems like a bug. Could you try wrapping the detailView in a NavigationStack? That seems to fix the issue on my end.

I'd appreciate it if you could open a bug report. Please don't forget to include the code snippet in the bug report that reproduces the issue. Once you open the bug report, please post the FB number here for my reference.

If you have any questions about filing a bug report, take a look at Bug Reporting: How and Why?

Thanks for flagging this out. I was able to reproduce the issue on my end as well and this seems like a bug. Could you try wrapping the detailView in a NavigationStack? That seems to fix the issue on my end.

I'd appreciate it if you could open a bug report. Please don't forget to include the code snippet in the bug report that reproduces the issue. Once you open the bug report, please post the FB number here for my reference.

If you have any questions about filing a bug report, take a look at Bug Reporting: How and Why?

why ToolbarItemGroup appears only on the first tab?
 
 
Q