It looks like it does have to do with how the button's label is declared. Here's my post about another bug where a button's hit target shrinks based on its label declaration:
SwiftUI Button with Image view label has smaller hit target
So if I change this sample code to use a label: closure with a Label() view, the button does appear gray when disabled. Interestingly though, it still responds to taps with a bounce animation, even though the action isn’t triggered.
That’s still inconsistent with how disabled buttons behave outside of a toolbar. Also, the button grows slightly wider when disabled.
Code
var body: some View {
NavigationStack {
VStack {
Button{
print("Body button tapped")
} label: {
Label("Body Button", systemImage: "checkmark")
}
.labelStyle(.titleOnly)
.buttonStyle(.borderedProminent)
.disabled(isButtonDisabled)
Toggle("Disable buttons", isOn: $isButtonDisabled)
Spacer()
}
.padding()
.navigationTitle("Device: \(osTitle)")
.navigationBarTitleDisplayMode(.large)
.toolbar {
ToolbarItem {
Button {
print("Toolbar button tapped")
} label: {
Label("Toolbar", systemImage: "checkmark")
}
.labelStyle(.titleOnly)
.buttonStyle(.borderedProminent)
.disabled(isButtonDisabled)
}
}
}
}