Buggy look of SwiftUI CommandMenu Buttons

Images cannot be linked here, but the code below produces buttons that are inset differently than all auto-generated MacOS buttons. Keyboard modifiers are white, rather than gray.

Dividers also don't work properly, nor accept color changes, nor it is reliable to sort in a Rectangle. Spacer() is selectable, but at least an empty Text("") is not.

Why?

Code Block swift
struct AppMenus: Commands {
func some() {}
@CommandsBuilder
var body: some Commands {
CommandMenu("Why") {
Button("So") { some() }
.keyboardShortcut(
KeyEquivalent("s"),
modifiers: .command)
Text(" ")
Spacer()
Divider()
.foregroundColor(Color(.doesntCare))
Button("Sad") { some() }
.keyboardShortcut(
KeyEquivalent("s"),
modifiers: .command)
}
CommandGroup(before: CommandGroupPlacement.sidebar) {
Button("Why my button so sad?") {}
.keyboardShortcut(KeyEquivalent("?"), modifiers: .command)
}
}
}


Replies

I've noticed this too, and filed feedbacks about it on June 28th (FB7813679), also noting that the checkmarks used to display toggle state in SwiftUI macOS menu items is different than the AppKit/system default.
Yeah, that and the memory leak from toggles.

Worse... if there are functions in a class instantiated somewhere down the chain, the menu commands don't have access to those functions.
Have you figured out a way to go past 10 items besides sub-menus?
You should be able to go past 10 items using Groups or Sections to break up your items (crazy that we have to use hacks like this though!).
Thanks for reminder re: Groups. Yep, that works.