However, if the app is in a modal state, AppKit skips over item validation and always disables the item.
Thanks for your feedback. Indeed, it seems that all menu items targeting a window or view controller are automatically disabled, while menu items targeting the app delegate can still be enabled, as well as the standard copy, paste, etc. I think the correct behaviour should be to still enable menu items targeting the modal window itself.
I think you may have reported this issue with Bug Reporter as FB9190141?
Yes, I opened FB9190141 2.5 years ago but got no response, which is why I decided to ask here. It would be great if you could investigate it.
Also to everyone else who might be tempted to use NSMenu.popUpContextMenu(_:with:for:): provide a made-up NSEvent and don't rely on NSApp.currentEvent being non-nil. When using VoiceOver for instance, it's nil.