iOS 16 - View tap area is wrong after presenting sheet and going to background

Steps to reproduce:

  1. Present sheet
  2. Go to background
  3. Go back to app
  4. Dismiss sheet
  5. Button has wrong tap area (It seems like its moved down by 50ish points)

It seems as if the view interaction hierarchy is the same as it was while the view was behind the sheet. See the image taken from View debugger below

You can reproduce it by creating a new project in XCode and adding this as ContentView:

import SwiftUI

struct ContentView: View {
    @State var isPresented = false

    var body: some View {
        ScrollView {
            Button("PresentSheet") {
                isPresented = true
            }
            .background(Color.red)
        }
        .sheet(isPresented: $isPresented) {
            Text("Sheet")
        }
    }
}

Bug is still present on iOS 16.1 beta 3

Did anyone encounter this, because it seems like a pretty big issue and the only way to fix it is to replace sheet with fullScreenCover?

1 Like