PSA: SwiftUI Button Click-Through Fixed in macOS 15

If your macOS app is a SwiftUI app with custom button styles that targets macOS 15+, you don’t need my click-through fix anymore.

Reported via Feedback Assistant on 2024-04-11, FB13720950 is now closed because macOS 15 Beta 2 solved the issue.

That means custom button styles and .plain button style will behave the same way normal macOS push buttons behave.

Update 2024-07-10:

Jason Sandmeyer (SwiftUI at Apple):

This comes along with the allowsWindowActivationEvents view modifier, which lets you customize the behavior or get this behavior in your own controls.

That API is a nice addition to macOS 15! Also:

you might notice Buttons with a destructive role still don’t perform their action with the same click that activates the window, which is expected behavior.

I’m really happy that so much care is put into this on the SwiftUI side, especially since macOS app developers wondered out loud whether SwiftUI will remain weirdly un-Mac-like and require workarounds forever.