I’m writing a MacOS app. I’m displaying a button. When the app is inactive, if I click the button, the button’s tap event gets triggered as the same time as the window is activated. So far so good.
However if I now add .buttonStyle(PlainButtonStyle())
to my button which is the desired look, it doesn’t get tapped when the window is inactive. The first click activates the window and I need a second click to trigger the button.
<code>Button {
print("tapped!")
} label: {
Image(systemName: "doc.on.doc")
.resizable()
.frame(width: 14, height: 14)
.padding(5)
}
.buttonStyle(PlainButtonStyle())
</code>
<code>Button {
print("tapped!")
} label: {
Image(systemName: "doc.on.doc")
.resizable()
.frame(width: 14, height: 14)
.padding(5)
}
.buttonStyle(PlainButtonStyle())
</code>
Button {
print("tapped!")
} label: {
Image(systemName: "doc.on.doc")
.resizable()
.frame(width: 14, height: 14)
.padding(5)
}
.buttonStyle(PlainButtonStyle())