[BUG] macOS native MenuBar doesn't flash on keypress

Noticed something fishy with macOS native MenuBar.
Steps to reproduce: launch DemoRunner/GUI/MenusDemo.h, hit a menu keyboard shortcut (command-R for instance); the JUCE MenuBar flashes, indicating the menu it triggered. Now hit Menu Position → Global menu (i.e., native menubar), hit the same keyboard shortcut, the menu bar doesn’t flash.

I’ve tracked down the problem to this inexplicable conditional in juce_mac_MainMenu.mm:

    void menuCommandInvoked (MenuBarModel*, const ApplicationCommandTarget::InvocationInfo& info) override
        if ((info.commandFlags & ApplicationCommandInfo::dontTriggerVisualFeedback) == 0
              && info.invocationMethod != ApplicationCommandTarget::InvocationInfo::fromKeyPress)
            if (auto* item = findMenuItemWithCommandID (getMainMenuBar(), info.commandID))
                flashMenuBar ([item menu]);

If I remove the condition info.invocationMethod != ApplicationCommandTarget::InvocationInfo::fromKeyPress, it flashes again and doesn’t seem to have any detrimental side-effects. Why would you prevent flashing the menu on keypresses? It seems like the whole point of flashing…

I came to a similar conclusion 4 or 5 months ago, posted about it, got no response.

In any case, I have removed that condition you reference in my projects and it works as expected.

1 Like

Ah thanks for the confirmation and the link. Hopefully it won’t go unnoticed this time :pray: