Section's .sheet(…) disappears first time shown when header: is set

I have a peculiar situation, where the first time I present a sheet from a Section that has the header: set, the sheet disappears by itself the first time it is presented.

@State private var show = false

// …

List {
    Section {
        Text("foo")
    } header: {
        Text("bar")
    }
    .sheet(isPresented: $show) {
        Text("baz")
    }

    // just to enable
    Button("toggle") {
        show = true
    }
}

In Xcode I get this warning when I present the sheet (taken from our live app):

Attempt to present <_TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView_: 0x10a819e00> on <_TtGC7SwiftUI19UIHostingControllerGVS_15ModifiedContentVS_7AnyViewVS_12RootModifier__: 0x10a020600> (from <_TtGC7SwiftUI32NavigationStackHostingControllerVS_7AnyView_: 0x10a0cba00>) while a presentation is in progress.

Tested on iOS 17.4.1, iPadOS 17.4.0 (Simulator), Xcode 15.3 Previews. 

Circumstances

The circumstances are as following: a Section has to be in a List, and have content:, and header: or footer: set to something, and have the .sheet(…) set on the section itself.

The problem does not occur with these sections:

Section {
    Text("…")
}
Section {
} footer: {
    Text("…")
}
Section {
    Text("…")
} header: {
}

… but the following views have the sheet disappear the first time it is presented:

Section {
    Text("…")
} header: {
    Text("…")
}
Section {
    Text("…")
} footer: {
    Text("…")
}
Section {
    Text("…")
} header: {
    Text("…")
} footer: {
    Text("…")
}

Is this a known issue, and are there any known workarounds to present from a Section?

My best guess is to move the .sheet(…) to the parent container, but I'll have to restructure part of my code quite a bit to do so 😕

This is still present in iOS 18; tested in Xcode 16 Previews for iOS 18

Filed bug report: FB15331755

Section's .sheet(…) disappears first time shown when header: is set
 
 
Q