Closed Bug 1263302 Opened 6 years ago Closed 5 years ago
[UI Events-code] Incorrect |code| for key events on Mac French/UK/Swedish (102) keyboard
Bug 1263302 Swap kVK_ISO_Section and kVK_ANSI_Grave key code values of ISO keyboard at computing KeyboardEvent.code value because macOS sends them as swapped
59 bytes, text/x-review-board-request
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 Steps to reproduce: Setup: Mac with with ISO 102 keyboard and French locale. Keyboard should be set up as ISO. (1) Go to Keyboard Event Test page: https://cdn.rawgit.com/w3c/uievents/gh-pages/tools/key-event-viewer.html (2) Type the following keys: * Key to left of Digit1 * Key between ShiftLeft and KeyZ Alternately: (1) Go to Keyboard Event Manual Test page for French: https://cdn.rawgit.com/w3c/uievents/gh-pages/tests/key-mtest-102fr-fr.html (2) Click "Show Options" (3) Make sure only 'keydown' is selected for 'Events' (4) Make sure only 'code' is selected for 'Attributes' (5) Start test Press the keys as they are highlighted. Note that the '^' key (near the end of the 2nd row) is skipped because it is a dead key. Use 'Esc' to skip keys (like 'Meta') that are trapped by the OS. Actual results: The following 3 keys produce incorrect |code| values: Correct |code| Char Actual |code| Location Backquote ² IntlBackslash Left of Digit1 IntlBackslash < Backquote Betwixt ShiftLeft and KeyZ This same problem (incorrect |code| values) also occurs for UK and Swedish locales. Probably for other Euro locales as well. Expected results: Correct |code| value for these keys. Note: corresponding Chromium bug: https://crbug.com/600607 Bug does not occur is keyboard is set up as ANSI or JIS.
Ignore the UserAgent line in the bug description. This bug is for Firefox 45.0.1.
Thank you garykac, for your report (and long time no see!). It sounds like OS X sends odd keyCode for 102 keyboard. Current code value on Mac is simply mapped from *virtual keycode* since OS X doesn't provide scancode (sigh). > Backquote ² IntlBackslash Left of Digit1 The VK must be kVK_ISO_Section. > IntlBackslash < Backquote Betwixt ShiftLeft and KeyZ The VK must be kVK_ANSI_Grave. We should check GetKbdType() when 102 keyboard is active and need to do special handling for these keys. (I don't know the return value of it because the result value isn't documented.) BTW, you said "The following 3 keys produce incorrect |code| values:". Is this a typo? you listed up only 2 keys. But you listed 3 keys in the chromium issue: > IntlHash * Backslash Right of Quote But "IntlHash" shouldn't be used anymore: https://github.com/w3c/uievents-code/issues/9
Component: Event Handling → Widget: Cocoa
OS: Unspecified → Mac OS X
Hardware: Unspecified → All
> > Comment 3 by email@example.com, Apr 5 (3 days ago) > > Because major OS's (Linux, Mac, Win) do not make it easy to distinguish between 'Backslash' and 'IntlHash', the UI Events spec has been updated to remove 'IntlHash': https://w3c.github.io/uievents-code/ > > So only the 'Backquote' and 'IntlBackslash' keys are incorrect. > Oh, I find this comment in the issue for Chromium. Okay, only the two keys are problem.
Oops! Sorry about that. I tried to cleanup the description and failed. :-(
Summary: Incorrect |code| for key events on Mac French/UK/Swedish (102) keyboard. → [UIEvents-code] Incorrect |code| for key events on Mac French/UK/Swedish (102) keyboard.
Summary: [UIEvents-code] Incorrect |code| for key events on Mac French/UK/Swedish (102) keyboard. → [UI Events-code] Incorrect |code| for key events on Mac French/UK/Swedish (102) keyboard.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2
Whiteboard: tpi:+ → [tpi:+][tpi-help-requested]
Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Comment on attachment 8841958 [details] Bug 1263302 Swap kVK_ISO_Section and kVK_ANSI_Grave key code values of ISO keyboard at computing KeyboardEvent.code value because macOS sends them as swapped https://reviewboard.mozilla.org/r/116012/#review117660
Attachment #8841958 - Flags: review?(m_kato) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/51b368d536a3 Swap kVK_ISO_Section and kVK_ANSI_Grave key code values of ISO keyboard at computing KeyboardEvent.code value because macOS sends them as swapped r=m_kato
You need to log in before you can comment on or make changes to this bug.