Closed Bug 938303 Opened 11 years ago Closed 10 years ago

Can't disable cmd-q in Firefox on Mac OS X. Both new shortcut(such as Cmd-Ctl-Q) and Cmd-Q invokes "Quit Firefox".

Categories

(Firefox :: Keyboard Navigation, defect)

25 Branch
x86
macOS
defect
Not set
normal

Tracking

()

VERIFIED FIXED
Firefox 32

People

(Reporter: vng, Assigned: myk)

References

Details

(Keywords: regression, Whiteboard: [regression by bug 189290 ])

Attachments

(4 files, 1 obsolete file)

Firefox doesn't seem to honor the OSX Keyboard Shortcuts for applications. Installing an addon like cmd-q catcher : https://addons.mozilla.org/EN-us/firefox/addon/cmd-q-catcher/ seems to be necessary to prevent cmd-q from closing Firefox. Shortcuts seem to work for other applications on my machine, and I found this : https://support.mozilla.org/en-US/questions/783393 which seems to indicate this error happens for other people as well. I can reproduce this problem after restarting Firefox with a completely new profile, so I don't think it's any addon I've got either.
keyconfig seems to do the right thing in Fx 25 for me. http://forums.mozillazine.org/viewtopic.php?t=72994
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
(In reply to Mats Palmgren (:mats) from comment #2) > *** This bug has been marked as a duplicate of bug 429824 *** How can all symptom of "Can't customize shortcuts on Mac" be same problem as a phenomenon of "Can't customize shortcuts on Mac" which was reported on 2008-04-19? How did you find that this bug on ac MOS X 10_9, Firefox 25 or later is same problem as that bug which was reported on 2008-04-19? Re-opening.
Status: RESOLVED → UNCONFIRMED
Ever confirmed: false
Resolution: DUPLICATE → ---
Summary: Can't disable cmd-q in Firefox → Can't disable cmd-q in Firefox on Mac OS X 10.9
As for "disabling ⌘Q", special care is needed, because both of next is defined in Firefox. http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser-sets.inc#428 <key id="key_quitApplication" key="&quitApplicationCmdUnix.key;" command="cmd_quitApplication" modifiers="accel"/> &quitApplicationCmdUnix.key; = Q, modifiers="accel" = ⌘ on Mac OS X -> ⌘Q is assgned http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser-menubar.inc#100 <menuitem id="menu_FileQuitItem" key="key_quitApplication" command="cmd_quitApplication"/> When association to "Quit Firefox" menu is changed from ⌘Q to Alt+F4 etc., does it work? - Expand Fireox menu of menu bar -> press Alt+F4 -> press ⌘Q - Collapse Fireox menu of menu bar -> press Alt+F4 -> press ⌘Q Following is a report at a forum in Japan. - Mac OS X 10.9.6, Firefox 29. - Swap ⌘Q and Option+⌘Q at shortcut definition for two menu items in Firefox menu. - When Firefox menu is expanded, ⌘Q and Oprion+⌘Q worked as expected. - When Firefox menu is collaped, Quit was executed by ⌘Q. FYI. Comment at a forum in 2009. > http://forums.macrumors.com/showthread.php?t=752904#post_rate_8156372 > Jul 25, 2009, 08:39 AM > tried this for firefox before and cmd+Q still worked. I changed it to Alt+F4 like windows has it, > and the new shortcut even showed up in the Firefox menu, but cmd+Q still quit the app. Followind document, which was written on Feb 26th, 2009, is pointed in it. > http://www.geekguides.co.uk/138/so-custom-keyboard-shortcuts-in-firefox-for-mac-os-are-broken/ This document pointed Bug 429824 and Bug 472271(closed as dup of Bug 429824). So, I think your problem is perhaps same as "Command-Q" part in Bug 429824 and many bugs closed as dup of Bug 429824. However, your problem is never "User-defined (custom, System Preferences) shortcuts don't work". Your problem is obviously "Can't disable cmd-q in Firefox on Mac OS X 10.9".
This bug may be regression by bug 189290 which was fixed on 2008-03-06, landed on Firefox 3. Changeset ID = c4fea50a2a65 > http://hg.mozilla.org/mozilla-central/rev/c4fea50a2a65 > 2.28 #ifdef XP_MACOSX > 2.29 <key id="key_sanitize_mac" command="Tools:Sanitize" keycode="VK_BACK" modifiers="accel,shift"/> > 2.30 - <key id="key_quitApplicationCmdMac" key="&quitApplicationCmdMac.key;" modifiers="accel"/> > 2.31 #endif > 2.32 +#ifdef XP_UNIX > 2.33 + <key id="key_quitApplication" key="&quitApplicationCmdMac.key;" command="cmd_quitApplication" modifiers="accel"/> > 2.34 +#endif Build defines for Mac OS X > https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Mac_OS_X_Prerequisites#Build_Defines > For OS X builds, defines are set up as follows: > XP_MACOSX is defined > XP_UNIX is defined Because XP_UNIX is defined, <key id="key_quitApplication" ...> was defined with oncommand=command="cmd_quitApplication" after parch for bug 189290, even though Mac OS X build , even though bug 189290 is for Linux build only. This was perhaps caused by confusion on #ifdef XP_MACOSX and #ifdef XP_UNIX. Following is a paragraph in Build_Instructions/Mac_OS_X_Prerequisites#Build_Defines. > This requires care when writing code for Unix platforms that exclude Mac: > #if defined(XP_UNIX) && !defined(XP_MACOSX) Is this kind of descriptin written in developer's gulde for Unix platform that exclude Mac?
CC-ing to Myk Melez who is owner of bug 189290. Myk Melez, I believe your patch of bug 189290 changed > from <key id="key_quitApplicationCmdMac" key="&quitApplicationCmdMac.key;" modifiers="accel"/? > (no command, so no oncommand) >.  to <key id="key_quitApplication" key="&quitApplicationCmdMac.key;" command="cmd_quitApplication" modifiers="accel"/> > Note: Recent code uses &quitApplicationCmdUnix.key., and &quitApplicationCmdMac.key is removed. > Because &quitApplicationCmdMac.key == &quitApplicationCmdUnix.key == "Q", it's not problem. in Mac OS X build. Is it intentional change?
Flags: needinfo?(myk)
FYI. It seems that bugs listed in dup chain of Bug 429824, which were opened before Bug 624881 and Bug 646362, is for problem of "new short cut assignment doesn't work". Bug 624881, Bug 646362, and this bug(Bug 938303) is for "Command-Q still invokes Quit after different short cut assignment to Quit Firefox".
(In reply to WADA from comment #6) > CC-ing to Myk Melez who is owner of bug 189290. > > Myk Melez, I believe your patch of bug 189290 changed > > from <key id="key_quitApplicationCmdMac" key="&quitApplicationCmdMac.key;" modifiers="accel"/? > > (no command, so no oncommand) > >.  to <key id="key_quitApplication" key="&quitApplicationCmdMac.key;" command="cmd_quitApplication" modifiers="accel"/> > > Note: Recent code uses &quitApplicationCmdUnix.key., and &quitApplicationCmdMac.key is removed. > > Because &quitApplicationCmdMac.key == &quitApplicationCmdUnix.key == "Q", it's not problem. > in Mac OS X build. > Is it intentional change? Yes, that was intentional! And it's correct, so it seems unlikely to be the cause of this bug, whose summary references Command+Q but whose description talks about keyboard shortcuts generally. The specific problem with Command+Q is highly likely to be a particular case of the general problem with keyboard shortcuts, i.e. bug 329824, which exists in Firefox 25+ as well as older versions of Firefox.
Flags: needinfo?(myk)
FYI. Bug 457973 was same problem which was reported for Firefox 3.0.3 on 2008-09-30.
(In reply to Myk Melez [:myk] [@mykmelez] from comment #8) > Yes, that was intentional! And it's correct, (snip) Thanks for your answer. It looks current design/implementation. > The specific problem with Command+Q is highly likely to be a particular case > of the general problem with keyboard shortcuts,(snip) Partiqularity in Command+Q case is; W is located at just right of Q, and A is located at just under Q, on Qwerty keyboard :-) Many user's want in Command+Q case is to avoid unwanted Quit due to pressing Command-Q when the tried to press Command-W. And, a problem in this bug is; User swaps shortcut key assignment in Firefox menu; (assume Option-Command-Q is also defined by <key>) Quit Firefox : Command-Q -> Option-Command-Q => Option-Command-Q is correctly shown at Quit Firefox XXX : Option-Command-Q -> Command-Q => Command-Q is correctly shown at XXX When menu is expanded, Option-Command-Q invokes Quit, and Command-Q invokes XXX. When menu is collapsed, Option-Command-Q invokes XXX, and Command-Q invokes Quit This is pretty confusing. It's mystery for user. Another problem in Firefox is: Mozilla had, and SeaMonkey has, feature of "confirmation dialog for Quit when multiple tabs are opened". This usefull guard feature for "pressing Command-Q by mistake" is removed from Firefox. Can enhancement like following possible? If Mac OS X, when shortcut key assigment for a <menuitem> is changed, alter command/oncommand association to the keyboard shortcut which is defined by <key>. In Win and Linux, "string shown at right position in menu" is "string of keyboard shortcut" which is pointed by <menuitem key="id of key binding"> or "access key string requested by <menuitem access-key="character in menu text">. In Mac OS X, "string shown at right position in menu" is "currently assigned shortcut key for menu" instead of "Firefox's keybind setting by <key>". I believe Firefox's key binding is better changed if "currently assigned shortcut key for a menu" is changed by user, in order to avoid user's confusion
Summary: Can't disable cmd-q in Firefox on Mac OS X 10.9 → Can't disable cmd-q in Firefox on Mac OS X
Status: UNCONFIRMED → NEW
Ever confirmed: true
(In reply to Myk Melez [:myk] [@mykmelez] from comment #8) > Yes, that was intentional! And it's correct, (snip) Is command(=>oncommand="quitApplication();") in <key> mandatory in Mac OS X build? Why no command(=>oncommand="quitApplication();") of <key> in Mac OS X build before you patch?
(In reply to Myk Melez [:myk] [@mykmelez] from comment #8) > Yes, that was intentional! And it's correct, (snip) What is reason why you changed from <key id="key_quitApp..." key="q" modifiers="accel"/? to <key id="key_quitApp..." key="q" modifiers="accel" command="cmd_quitApplication" /> in Mac OS X build, when you created patch for bug 189290 which is for Linux build?. What kind of problem existed in Mac OS X build which was caused by "no command in <key>"?
Flags: needinfo?(myk)
Note: Cmd+C, Cmd+V etc. and Cmd+W is listed in Firefox_Keyboard_and_Mouse_Shortcuts.html, but Cmd+Q is not listed.
FYI. Initial browser-sets.inc in HG. Merge from CVS. > http://hg.mozilla.org/mozilla-central/annotate/9b2a99adc05e/browser/base/content/browser-sets.inc > Thu Mar 22 10:30:00 2007 -0700 (at Thu Mar 22 10:30:00 2007 -0700) > Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT, > hg@1 315#ifdef XP_MACOSX > hg@1 316 <key id="key_sanitize_mac" command="Tools:Sanitize" keycode="VK_BACK" modifiers="accel,shift"/> > hg@1 317 <key id="key_quitApplicationCmdMac" key="&quitApplicationCmdMac.key;" modifiers="accel"/> > hg@1 318#endif No <key id="key_quit..."/> is defined for Win/Linux build since initial. <key id="key_quit..."/> is defined for Mac OS X only, and there is no commamd/oncommand since initial. command="cmd_quitApplication" of Mac OS X build was introduced by patch for bug 189290. <key id="key_quit..." without command/oncommand /> is perhaps because "string for shortcut" only is needed in order to show shortcut assignment by Mac OS X to Quit Firefox menu.
A way to clear command attribute of <key id="key_quitApplication">. (1) Install Addon(Custom Buttons, or PrefBar). (2) Create a toolbar button by the Addon. (3) Put following code as script of the button. > var QuitKeyID = "key_quitApplication" ; var QuitKey = document.getElementById(QuitKeyID) ; > if( !QuitKey ) { alert(QuitKeyID + " is not found.") ; return ; } > var CommandOfQuitKey = QuitKey.getAttribute("command") ; > var OnCommandOfQuitKey = QuitKey.getAttribute("oncommand") ; > if( CommandOfQuitKey || OnCommandOfQuitKey ) > { > QuitKey.removeAttribute("command") ; > QuitKey.removeAttribute("oncommand") ; > alert("Command+Q is killed") ; > } (4) Click the button var NewCMD="original" ; if( CommandOfQuitKey || OnCommandOfQuitKey ) { NewCMD = "DoNothing" ; QuitKey.removeAttribute("command") ; QuitKey.removeAttribute("oncommand") ; alert("Command+Q is killed") ; } else { // command is used originally, but use oncommand var type = "oncommand" ; QuitKey.setAttribute(type , CMD[type]) ; alert("Command+Q is enabled again") ; }
(In reply to WADA from comment #12) > What is reason why you changed > from <key id="key_quitApp..." key="q" modifiers="accel"/? > to <key id="key_quitApp..." key="q" modifiers="accel" > command="cmd_quitApplication" /> > in Mac OS X build, when you created patch for bug 189290 which is for Linux > build?. > What kind of problem existed in Mac OS X build which was caused by "no > command in <key>"? There wasn't a problem with the Mac OS X <key> element, I only changed it in order to reuse code between Mac and Linux, since the two implementations were similar. I took a closer look today, and it seems like the change in bug 189290 is in fact responsible for this problem, since removing the "command" attribute from the cmd_quitApplication <key> element enables me to successfully reassign the shortcut using Mac OS X's Settings > Keyboard > Shortcuts panel. And it looks like that "command" attribute is extraneous on Mac. Without it, the default shortcut continues to function as expected, presumably because the menu_FileQuitItem <menuitem> element assigns both a "key" and a "command" to the <menuitem>. So here's a patch that removes the "command" attribute. With this patch applied, and without a custom shortcut, Firefox's behavior is the same: Command+Q quits the app. With the patch and with a custom shortcut (I tested with Command+Option+Control+Q), Firefox's behavior is as expected: Command+Q doesn't quit the app, while the custom shortcut does quit the app. (Linux should continue to behave the same, but I'm building there and will then test to make sure.)
Assignee: nobody → myk
Status: NEW → ASSIGNED
Attachment #8426685 - Flags: review?(gavin.sharp)
Flags: needinfo?(myk)
(In reply to Myk Melez [:myk] [@mykmelez] from comment #17) > (Linux should continue to behave the same, but I'm building there and will > then test to make sure.) My build finished, and I tested it: it works as expected.
No longer blocks: 457973
No longer blocks: 515395
No longer blocks: 624881
No longer blocks: 646362
Thanks for patch. We now can add comment of "Command+Q now can be disabled even in Firefox by hard effort for long time" at many many many Mac OS X/Firefox forums. https://www.google.com/#q=Mac+os+x+firefox+command+q
FYI. In both SeaMonkey and Thunderbird for Mac OS X, <key> for cmd_quit is defined with command attribute, as you did. I believe this is because; Quit by Command+Q when user tried to press Command+W, even after user changed shortcut for Quit; is not big issue in Tunderbird, so command is kept. is not big issue in SeaMonkey, because SeaMonkey asks user if more than one tab is opened. So command is kept. is big issue in Firefox, because Firefox doesn't ask, and because number of Firefox users on Mac OS X is pretty large. So someone, who knows problem of "pressing Command+Q instead of Command+W", removed command from <key> for Command+Q. , If Thunderbird,
By the way, why bug 457973, bug 515395, bug 624881, bug 646362, and bug 938303(this bug) were closed as dup of bug 429824? If bug 457973 was kept open or problem was analyzed in that bug, I believe problem would have been resolved in Firefox 3.0 era. Even after Firefox 3.0 era, it would be surely far earlier than release of Australis by Firefox 29. No guide line for general users about duping in bugzilla.mozilla.org?
Bug 316459 and Bug 328746 are Cmd+M/Cmd+J case. Myk Melez, same mechanism as Cmd+Q case? Is removing "command" possible in Cmd+M/Cmd+J case?
1. Install "Custom Buttons" Add-on 2. Create a button, put script code in "Code" 3. Click button => current hotkeys in Firefox is printed in Browser Console 4. At Browser Console, Select All, Copy, Paste at Text Editor, Clear Browser Console
Flags: needinfo?(myk)
Attachment #8426685 - Flags: review?(gavin.sharp) → review?(enndeakin)
(In reply to WADA from comment #26) > Bug 316459 and Bug 328746 are Cmd+M/Cmd+J case. > Myk Melez, same mechanism as Cmd+Q case? Is removing "command" possible in > Cmd+M/Cmd+J case? As with Command+Q, both of those keyboard shortcuts also have associated <menuitem> elements, so it might be possible. But I don't actually understand the mechanism by which those elements get reflected into Mac keyboard shortcuts, and I haven't tested it, so I can't say for sure.
Flags: needinfo?(myk)
Bug 316459, which was report for Firefox 1.5, reported following phenomenon. 1. Assign new ShortcutY to MenuItemX(Command-x). 2. Before click of MenuItemX, ShortcutY doesn't work. 3. After click(select) of MenuItemX, ShortcutY does work. 4. Even if Command-x is assigned to other MenuItemZ, command-x still invokes MenuItemX(this bug). Other bugs after Firefox 3 reports; 5. When new ShortcutY is pressed, MenuItemX blinks, but MenuItemX is not invoked. (Open Download manager=Cmd+J, Edit/Copy etc., ...), This won't occur in "new shortcut for Quit Firefox case"(==this bug). Does 2/3 of above occur in yor "Command+Option+Control+Q for Quit Firefox menu" case in recent Firefox?
In all of Command-Q, Command-M, Command-J case, definition style is same. <key id="key_Keyname" key="key_top_value" modifies="accel" command="ID_of_command_for_menu"> <menuitem id="ID_of_menu" key="key_Keyname" command="ID_of_command_for_menu"> Difference is: key binding Major menu Sub menu <key> Command-Q Firefox Quit Firefox Hotkey: Q,accel, id = key_quitApplication, command = cmd_quitApplication Command-M Window Minimize Hotkey: M,accel, id = key_minimizeWindow, command = minimizeWindow Command-J Tools Download Hotkey: J,accel, id = key_openDownloads, command = Tools:Downloads Phenomenon depends on Major menu? Or phenomenon depends on used oncommand script invoked via command? Affected by shortcut of OS X or Finder? Command-Q Quit the frontmost application Command-M Minimize the active window to the Dock Command-M Minimize window (Finder) Command-J Scroll to a selection Command-J Show View Options (Finder)
Whiteboard: [regression by bug 189290 ]
Bug 827652 was for "Shortcut for Window > Zoom" case. Because "Window > Zoom" doesn't have pre-assigned shortcut, symptom is simpler than other cases. I'll try to find "differences/simlarities among Cmd-Q/Cmd-M/Cmd-J/Window-Zoom" in that bug. Myk Melez, thanks for your help.
No longer blocks: 316459, 328746
Comment on attachment 8426685 [details] [diff] [review] enable user to reassign "quit application" shortcut on Mac Should be ok. This causes the key to be mapped through the menu rather than firing through the <key>.
Attachment #8426685 - Flags: review?(enndeakin) → review+
Summary: Can't disable cmd-q in Firefox on Mac OS X → Can't disable cmd-q in Firefox on Mac OS X. Both new shortcut(such as Cmd-Ctl-Q) and Cnd-Q invokes "Quit Firefox".
Summary: Can't disable cmd-q in Firefox on Mac OS X. Both new shortcut(such as Cmd-Ctl-Q) and Cnd-Q invokes "Quit Firefox". → Can't disable cmd-q in Firefox on Mac OS X. Both new shortcut(such as Cmd-Ctl-Q) and Cmd-Q invokes "Quit Firefox".
Status: ASSIGNED → RESOLVED
Closed: 11 years ago10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 32
Another big problem around Command+Q is: No warninq upon quit/No confirmation dialog upon quit, even when following is set, if sesstion save is enabled. browser.warnOnQuit = true browser.tabs.warnOnClose = true This is bug 550559 and bug 502908. Essentially, those bugs are not relevant to problem of this bug, but setting dependency for ease of problem analysis and tracking and search. Note : if those bug is resolved first, severity/priority of this bug can be changed to Severity=No impact/Priority=Lowset.
Depends on: 550559, 502908
Reproduced the issue on old Nightly (2014-05-26) using Mac OS X 10.9.4 and verified that cmd+q does not quit Firefox 32 beta 8 if I change the shortcut.
Status: RESOLVED → VERIFIED
Keywords: verifyme
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: