Hey all,
Currently tested in Xcode 13 / BigSur
It seems the keyboard focus feature of macOS does not work with any Button
in SwiftUI that uses a custom ButtonStyle
.
You can attach the .focusable()
modifier to the Button
(or ButtonStyle)
to allow Tab / Shift+Tab navigation between buttons, however pressing Space
does not execute the button as expected.
Is there something I'm missing? or is this intentionally not supported?
To work around this, all I can think of is using a UIRepresentableView
around NSButton,
however I'd like to avoid that if possible.
Here is an example View
to show the problem: https://gist.github.com/deanPGM/71ddfbe87a47454d220b16809a489f69