Closed Bug 534014 Opened 15 years ago Closed 14 years ago

Commands on menuitems with submenus aren't triggered in the menu bar

Categories

(Mozilla Labs :: Jetpack Prototype, defect)

All
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: adw, Unassigned)

References

(Depends on 1 open bug)

Details

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:

  jetpack.menu.add({
    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);
  }
  jetpack.menu.add({
    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.
Related is bug 526382.
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.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.