Closed Bug 735648 Opened 8 years ago Closed 8 years ago

Cmd + Opt + something shortcut keys don't work in "Dvorak - Qwerty ⌘" keyboard layout


(Core :: Widget: Cocoa, defect)

Not set





(Reporter: jg, Assigned: masayuki)


(Whiteboard: [key hell])


(2 files, 2 obsolete files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20100101 Firefox/11.0
Build ID: 20120312181643

Steps to reproduce:

Mac OS X has a keyboard layout called "Dvorak - Qwerty ⌘" where the keys are ordinarily in the Dvorak layout, but when the ⌘ (Command) key is held down, it temporarily switches back to Qwerty. Thus, you can type text in Dvorak, but all the keyboard shortcuts in your muscle memory still work.

While using he Dvorak-Qwerty ⌘ layout, I attempted to trigger the Web Developer: Inspect menu item with shortcut key Opt-Cmd-I.

Actual results:

The tools menu highlights briefly (but does not open), but the Inspect mode is not triggered.

Expected results:

The inspect mode should have started. Note that if I first click on the Tools menu, the keyboard shortcut works as expected.
Component: Untriaged → Widget: Cocoa
Ever confirmed: true
Product: Firefox → Core
QA Contact: untriaged → cocoa
Summary: Some shortcut keys don't work in "Dvorak - Qwerty ⌘" keyboard layout → Cmd + Opt + something shortcut keys don't work in "Dvorak - Qwerty ⌘" keyboard layout
Whiteboard: [key hell]
Version: 11 Branch → Trunk
Assignee: nobody → masayuki
Attached patch Patch (obsolete) — Splinter Review
tryserver builds:

This patch depends on the patches of bug 479942 and others.
Comment on attachment 606187 [details] [diff] [review]

I think that this is a mistake.

|!isDvorakQWERTY| means we don't need to append altCharCodes for Dvorak-Qwerty because charCode and cmdedChar (or cmdedShiftChar) must be same. But there is the case Alt key is pressed (Mac's Alt key is similar to AltGr of other platforms).

So, if cmdedChar or cmdedShiftChar doesn't match to the charCode, we should append them.
Attachment #606187 - Flags: feedback?(karlt)
Attachment #606187 - Flags: review?(smichaud)
Comment on attachment 606187 [details] [diff] [review]

I haven't tested this.  But it looks like it shouldn't do harm.
Attachment #606187 - Flags: review?(smichaud) → review+

Would you check the patch for feedback? I'd like to land this ASAP due to the risk.
Looks like this code was added in (bug 432388).  Still making sense of it.
Comment on attachment 606187 [details] [diff] [review]

It doesn't feel right to me to add the Qwerty alternative char codes when
!isMeta, because we have already included the Dvorak char codes.

For other isCmdSwitchLayout layouts, don't we still want to include
cmdedChar when preferredCharCode is cmdedShiftChar?

>+  // cmdedChar or comdedShiftChar, we don't need to do it.

Please fix up comded here.
Attachment #606187 - Flags: feedback?(karlt) → feedback-
Attached patch Patch (obsolete) — Splinter Review
Did you mean this?

Comparing charCode makes it more complicated. Therefore, I removed it. It shouldn't be an issue for performance.
Attachment #606187 - Attachment is obsolete: true
Attachment #610429 - Flags: review?(karlt)
Ah, note that the new patch includes the change for bug 677252 for new tests because the bug is still blocked by bug 447757. But this bug should go first.
Comment on attachment 610429 [details] [diff] [review]

>+  bool isCmdPressedOnDvorakQWERTY = aKeyEvent.isMeta && isDvorakQWERTY;

>-  if ((unshiftedChar || shiftedChar) &&
>-      (!aKeyEvent.isMeta || !isDvorakQWERTY)) {
>+  if ((unshiftedChar || shiftedChar) && !isCmdPressedOnDvorakQWERTY) {

>-  // Latin char for the key. But don't append at Dvorak-QWERTY.
>-  if ((cmdedChar || cmdedShiftChar) && isCmdSwitchLayout && !isDvorakQWERTY) {
>+  if ((cmdedChar || cmdedShiftChar) && isCmdSwitchLayout &&
>+      (!isDvorakQWERTY || isCmdPressedOnDvorakQWERTY)) {

Yes, this logic looks good to me, but I don't think the boolean isCmdPressedOnDvorakQWERTY is helping here.
I would just leave the first test as is and use (!isDvorakQWERTY || aKeyEvent.isMeta) in the second, or perhaps swap the order of the variables in one of the tests to be consistent.
Attached patch PatchSplinter Review
Attachment #610429 - Attachment is obsolete: true
Attachment #610429 - Flags: review?(karlt)
Attachment #610749 - Flags: review?(karlt)
Attachment #610749 - Flags: review?(karlt) → review+
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.