Disabled button from SwiftUI is incorrectly rendered on macOS Ventura
wojciech-kulik opened this issue · 0 comments
wojciech-kulik commented
Describe the bug
After migrating to macOS Ventura and Xcode 14.0.1 disabled buttons on my snapshots are incorrectly rendered.
To Reproduce
func testSnapshot() {
let controller = NSHostingController(rootView: MyView())
controller.view.frame = .init(x: 0, y: 0, width: 600, height: 600)
assertSnapshot(matching: controller, as: .image)
}
// ...
struct MyView: View {
var body: some View {
VStack {
Button(action: {}, label: { Text("Delete").frame(width: 150) })
.disabled(true)
}
}
}
Expected behavior
The disabled Button should be correctly rendered with dark text.
Environment
- swift-snapshot-testing version 1.9.0
- Xcode 14.0.1 (14A400)
- Swift 5.7
- OS: macOS Ventura 13.0
Additional context
Buttons work properly when I run the application. I noticed that this problem occurs also on the SwiftUI preview until you change something on the View
. It looks like the button is in the middle of the transformation, the background is greyed out but the text is still white. .wait(for: X, on: .image)
doesn't help either.