SwiftUI popover from the nav bar doesn't dismiss properly

A SwiftUI popover presented from a button installed in the nav bar via .toolbar(...) does not dismiss when tapped outside the popover. Instead, it jumps to the upper left corner of the screen.

This started happening in Xcode 12 beta 6. I've filed a bug with Apple (FB8546290).

Code Block
.toolbar {
    Button("Bad Popover") {
        isShowingBadPopover.toggle()
    }
    .popover(isPresented: $isShowingBadPopover) {
        Text("Tap outside and notice that the popover moves instead of being dismissed.")
            .padding()
            .frame(width: 320, height: 100)
    }
}


Thanks for submitting the bug report. I'm getting the same behavior on beta 5.
Got into the same issue today, the workaround I found is to make a NavigationView and everything that will invoke popovers in .navigationBarItems instead.
Hit me up if there is a better solution.
This is NOT fixed in Xcode 12 GM
Also seeing this in Xcode 12.1.
Haven solved in Xcode 12.2 beta 4
Popover still useless in Xcode 12.3, iOS 14.3 since dismissing it by dragging down makes it jump up and down.

Appears that popover dismiss (or it is losing its anchor/appearing in left top corner) seems to be fixed in iOS 15/XCode 13 beta.

SwiftUI popover from the nav bar doesn't dismiss properly
 
 
Q