The default bug view has changed. See this FAQ.

key definition with control key modifier doesn't execute command when it's attached to a menuitem (Mac only)




Widget: Cocoa
8 years ago
8 years ago


(Reporter: John Brugge, Unassigned)


Firefox Tracking Flags

(Not tracked)



(1 attachment)



8 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: Gecko/20090824 Firefox/3.5.3
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: Gecko/20090824 Firefox/3.5.3

On OS X only, if a XUL overlay defines a key that has a modifier containing "control", then the key's oncommand is not executed if the key is associated with a menuitem. It _will_ execute the oncomand if the key definition is _not_ associated with any menuitem.

For example, in the following overlay (adapted from the helloworld extension), pressing control+shift+a will cause the Tools menu to flash, but the alert is never shown. 

  <menupopup id="menu_ToolsPopup">
    <menuitem id="helloworld-hello" label="Hello World!" insertafter="devToolsSeparator"

    <keyset id="mainKeyset">
      <key id="myMenuKey"
           modifiers="control,shift" oncommand="alert('bingo!');"/>

Detach the key from the menuitem, and the key combination will then work. Other key combinations that don't include 'control' in their modifiers (e.g. 'accel', 'alt') do work when the key is attached to the menuitem.

I will attach a modified version of the helloworld extension that demonstrates this.

Reproducible: Always

Steps to Reproduce:
1. Build and install the attached extension as-is ("ant jar" will create the .xpi).
2. The starting configuration of the extension has a menu item and a key definition, unrelated to each other.
3. Tools menu has 'Hello World!' with no keyboard shortcut.
4. Press control+shift+a and an alert should appear.
5. Edit the overlay.xul to put 'key="myMenuKey"' as an attribute on the menuitem
6. Re-build and re-install the extension.
7. Tools menu has 'Hello World!' with a keyboard shortcut of control-shift-a.
8. Press control+shift+a and no alert appears, and 'Tools' menu flashes.
9. Edit the overlay.xul and change the key modifiers to 'accel,shift'.
10. Re-build and re-install the extension.
11. Tools menu has 'Hello World!' with a keyboard shortcut of apple-shift-a.
12. Press apple+shift+a and an alert should appear, and 'Tools' menu flashes.
Actual Results:  
With 'control' as one of the modifiers in the key definition, and the key definition attached to a menu item, the key's oncommand function is never called.

Expected Results:  
The oncommand function of the key should be called.

Comment 1

8 years ago
Created attachment 403545 [details]
Variant on the helloworld extension. 

I added a build.xml to do a simple Ant bundling of the extension. The that came with the sample had some problems on OS X.


8 years ago
Component: XUL → Widget: Cocoa
QA Contact: xptoolkit.widgets → cocoa
You need to log in before you can comment on or make changes to this bug.