Button taps in scroll views are not cancelled on scroll inside sheets

When you touch down on a button in a scroll view, you can cancel the tap by scrolling. In SwiftUI, this works correctly when the scroll view is not inside a dismissible sheet.

However, if the scroll view is inside a sheet that can be dismissed with a drag gesture, scrolling does not cancel the button touch, and after scrolling, the button tap is activated.

This happens whether the modal is presented from SwiftUI using the sheet modifier, or wrapped in a UIHostingController and presented from UIKit.

This is a huge usability issue for modals with scrollable content that have buttons inside of them.

Video of behavior: https://youtube.com/shorts/w6eqsmTrYiU

Easily reproducible with this code:

import SwiftUI

struct ContentView: View {
    @State private var isPresentingSheet = false

    var body: some View {
        ScrollView {
            LazyVStack {
                ForEach(0..<100, id: \.self) { index in
                    Button {
                        isPresentingSheet = true
                    } label: {
                        Text("Button \(index)")
                            .padding(.horizontal)
                            .padding(.vertical, 5)
                            .frame(maxWidth: .infinity, alignment: .leading)
                    }
                }
            }
            .padding()
        }
        .sheet(isPresented: $isPresentingSheet) {
            ContentView()
        }
    }
}

Our engineering teams need to 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 code snippet that reproduces the issue and the screen recording, and post the FB number here once you do.

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

Button taps in scroll views are not cancelled on scroll inside sheets
 
 
Q