Quick look preview is closing sheet by accident on visionOS

Hello!

I have a simple app that opens a sheet and when you press a button on the sheet it will open a quick look preview of a picture. That works great but when I exit the quick look preview it will close the sheet too. This seems like unexpected behavior because it doesn't happen on iOS.

Any help is appreciated, thank you.

Here is some simple repo:

import QuickLook
import SwiftUI

struct ContentView: View {
    @State private var pictureURL: URL?
    @State private var openSheet = false
    
    var body: some View {
        Button("Open Sheet") {
            openSheet = true
        }
        .sheet(isPresented: $openSheet) {
            Button("Open Picture") {
                pictureURL = URL(fileURLWithPath: "someImagePath")
            }
            // When quick look closes it will close the sheet too.
            .quickLookPreview($pictureURL)
        }
    }
}

And here is a quick video:

Hey @klinee101,

Thanks for your post. Given the different behavior between iOS and visionOS this does feel like a bug to me. I'd like to have our engineering teams investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report, include the sample app and a video of the behavior on both platforms, and post the FB number here once you do.

Bug Reporting: How and Why? has tips on creating your bug report.

Thanks,
Michael

Quick look preview is closing sheet by accident on visionOS
 
 
Q