Last Comment Bug 534014 - Commands on menuitems with submenus aren't triggered in the menu bar
: Commands on menuitems with submenus aren't triggered in the menu bar
Product: Mozilla Labs
Classification: Other
Component: Jetpack Prototype (show other bugs)
: unspecified
: All Mac OS X
-- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
Depends on: 534008
  Show dependency treegraph
Reported: 2009-12-10 11:48 PST by Drew Willcoxon :adw
Modified: 2010-02-26 11:35 PST (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---


Description User image Drew Willcoxon :adw 2009-12-10 11:48:09 PST
On OS X only, for menus in the menu bar only, commands on menuitems with submenus are not triggered when ancestor menuitems are clicked.  For example, the following command function is never called when the "foo" and "bar" submenu items are clicked:{
    label: "Broken on OS X :(",
    menu: new jetpack.Menu(["foo", "bar"]),
    command: function () console.log("I'm never called")

As a workaround you can define a single function and attach it to "foo" and "bar" directly:

  function myCommand(menuitem) {
    console.log("Clicked " + menuitem.label);
    label: "This Works",
    menu: new jetpack.Menu([
      { label: "foo", command: myCommand },
      { label: "bar", command: myCommand }

Due to platform bug 534008.  When that's fixed, this one will be, too, but maybe we can come up with a workaround in the meantime.
Comment 1 User image Drew Willcoxon :adw 2009-12-10 12:04:10 PST
Related is bug 526382.
Comment 2 User image Daniel Buchner [:dbuc] 2010-02-26 11:35:56 PST
We will be monitoring all these issues after the rebooted Jetpack code base is released in the first week of March to ensure their causes are not duplicated. Many of the bugs/issues with the prototype version of Jetpack will be made irrelevant given the structure of the new SDK.

Note You need to log in before you can comment on or make changes to this bug.