iPad - List View - background to foreground - moves up

Please help. Happens only in iPad device

Run the app, looks fine. Press home button, select app, below mentioned bugs happen (sometimes first time, sometimes 2nd, 3rd, 4th time)

  1. The list in the sidebar moves up (space between top nav bar and list is lost)
  2. The detail view's toolbar's items vanish (principal, leading, trailing vanish, bottom stays)
import SwiftUI

struct ContentView: View {
    var body: some View {
        NavigationSplitView {
            // Leading side (typically a list or navigation links)
            List {
                NavigationLink("Item 1", destination: detailView(text: "Detail View for Item 1"))
                NavigationLink("Item 2", destination: detailView(text: "Detail View for Item 2"))
                NavigationLink("Item 3", destination: detailView(text: "Detail View for Item 3"))
                NavigationLink("Item 4", destination: detailView(text: "Detail View for Item 4"))
                NavigationLink("Item 5", destination: detailView(text: "Detail View for Item 5"))
                NavigationLink("Item 6", destination: detailView(text: "Detail View for Item 6"))
                NavigationLink("Item 7", destination: detailView(text: "Detail View for Item 7"))
                NavigationLink("Item 8", destination: detailView(text: "Detail View for Item 8"))
                NavigationLink("Item 9", destination: detailView(text: "Detail View for Item 9"))
                NavigationLink("Item 10", destination: detailView(text: "Detail View for Item 10"))
                NavigationLink("Item 11", destination: detailView(text: "Detail View for Item 11"))
                NavigationLink("Item 12", destination: detailView(text: "Detail View for Item 12"))
                NavigationLink("Item 13", destination: detailView(text: "Detail View for Item 13"))
                NavigationLink("Item 14", destination: detailView(text: "Detail View for Item 14"))
                NavigationLink("Item 15", destination: detailView(text: "Detail View for Item 15"))
                NavigationLink("Item 16", destination: detailView(text: "Detail View for Item 16"))
                NavigationLink("Item 17", destination: detailView(text: "Detail View for Item 17"))
                NavigationLink("Item 18", destination: detailView(text: "Detail View for Item 18"))
            }
            .toolbar {
                ToolbarItem(placement: .principal) {
                    Text("Items")
                }
                ToolbarItem(placement: .navigationBarLeading) {
                         Button(action: {
                            let _ = print("going back to main screen")
                        })
                        {
                            Image(systemName: "chevron.left")
                        }
                    }
                }
        } detail: {
            // Default detail view when nothing is selected
            Text("Select an Item")
        }
    }
    
    // Function to generate a detail view with a principal toolbar item
    @ViewBuilder
    func detailView(text: String) -> some View {
        Text(text)
            .toolbar {
                ToolbarItem(placement: .principal) {
                    Text(text)
                }
                ToolbarItem(placement: .navigationBarTrailing) {
                    Text("Trailing")
                }
                ToolbarItem(placement: .bottomBar) {
                    Text("Bottom")
                }
            }
    }
}

// Preview
struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

I tested your code on iPad simulator and could not reproduce.

Please explain in detail the different steps.

iPad - List View - background to foreground - moves up
 
 
Q