Open Bug 519496 Opened 11 years ago Updated 11 years ago
key definition with control key modifier doesn't execute command when it's attached to a menuitem (Mac only)
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:126.96.36.199) Gecko/20090824 Firefox/3.5.3 Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:188.8.131.52) 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" oncommand="HelloWorld.onMenuItemCommand(event);" key="myMenuKey"/> </menupopup> <keyset id="mainKeyset"> <key id="myMenuKey" key="a" modifiers="control,shift" oncommand="alert('bingo!');"/> </keyset> 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.
I added a build.xml to do a simple Ant bundling of the extension. The build.sh that came with the sample had some problems on OS X.
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.