This seems to be due to the List's layout behaviour. I don't know any solution other than not using a List in this case.
Here's some reproducible code where you can uncomment the List to see the difference.
import SwiftUI
struct ButtonContextMenuTest: View {
var body: some View {
// List {
Section {
ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(spacing: 15) {
ForEach(0..<8) { index in
Button(action: {
//action here...
}) {
VStack(spacing: 10) {
Image(systemName: "plus")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 30, height: 30)
.cornerRadius(10)
Text("Button")
.foregroundColor(.primary)
.font(.footnote)
.multilineTextAlignment(.center)
.padding(.top, 5)
.frame(width: 80)
}
.frame(width: 80, height: 100)
.background(.thinMaterial, in: RoundedRectangle(cornerRadius: 12))
}
.contextMenu {
Button("HELLO"){
}
}
}
}
.padding()
}
}
}
// }
}
#Preview {
ButtonContextMenuTest()
.preferredColorScheme(.dark)
}
When not in a List, the contextMenu behaves as expected: