VStack within ScrollView on macOS 15.2 makes bottom area unclickable

Suppose there are two buttons in VStack, the second button is unclickable. I'm running macOS 15.2 with Xcode 16.2.

import SwiftUI

struct ContentView: View {
    var body: some View {
        ScrollView(.horizontal) {
            VStack {
                Spacer()
                // this button is clickable
                Button("foo") {
                    print("foo")
                }
                // this button can't be clicked
                Button("bar") {
                    print("bar")
                }
            }
        }
    }
}
  • If I change .horizontal -> .vertical and VStack -> HStack, the second button behave normally.
  • If I remove ScrollView, everything works fine.
  • it works fine before macOS 15.2.

I tested in Xcode 16.2 with iOS 18.1 simulator, MacOS 14.7.

It works with horizontal and VStack (even though buttons are squeezed in the lower left corner). I doubt the problem may come from macOS version.

Same in Xcode 15.3 with iOS 18.1 simulator.

Same with Xcode 15.0.1 and simulator 18.0.

Could you test the modified code to see if it works on real device (and simulator):

struct ContentView: View {
    @State private var showFoo = false
    @State private var showBar = false

    var body: some View {
        ScrollView(.horizontal) {
            VStack {
                Spacer()
                // this button is clickable
                Button("foo") {
                    print("foo")
                    showFoo.toggle()
                }
                // this button can't be clicked
                Button("bar") {
                    print("bar")
                    showBar.toggle()
                }
                if showFoo { Text("Foo")}
                if showBar { Text("Bar")}
            }
        }
    }
}

though set height for scrollview works, but if wrapped in a GeometryReader, bug reappear.

    var body: some View {
        // if remove this, second button can be tapped
        GeometryReader { _ in
            ScrollView(.horizontal) {
                VStack {
                    Spacer()
                    // this button is clickable
                    Button("foo") {
                        print("foo")
                        showFoo.toggle()
                    }
                    // this button can't be clicked
                    Button("bar") {
                        print("bar")
                        showBar.toggle()
                    }
                    if showFoo { Text("Foo") }
                    if showBar { Text("Bar") }
                }
            }
            .frame(height: 200)
        }
    }

What is the point of Geometry reader ?

I tested with GeometryReader in Xcode 16.2. It works.

I'm surprised bug may come from MacOS 15.2

But file a bug report.

VStack within ScrollView on macOS 15.2 makes bottom area unclickable
 
 
Q