New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 600607 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 1
Type: Bug

Blocked on:
issue 608493

Blocking:
issue 340077



Sign in to add a comment

Incorrect |code| for key events on Mac French/UK/Swedish (102) keyboard.

Project Member Reported by garykac@chromium.org, Apr 5 2016

Issue description

Version: 48.0.2564.116 (64-bit)
OS: Mac

What steps will reproduce the problem?
(1) Mac with with ISO 102 keyboard and French locale.
(2) Go to Keyboard Event Manual Test page for French: https://cdn.rawgit.com/w3c/uievents/gh-pages/tests/key-mtest-102fr-fr.html
(3) Click "Show Options"
(4) Make sure only 'keydown' is selected for 'Events'
(5) Make sure only 'code' is selected for 'Attributes'
(6) 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.


What is the expected output?
All keys pass and turn green.


What do you see instead?
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
IntlHash            *      Backslash        Right of Quote



This same problem (incorrect |code| values) also occurs for UK and Swedish locales. Probably for other Euro locales as well.

 
Blocking: 340077
This was tested using an external USB UK (102) keyboard plugged into a US Mac laptop.

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.
Labels: -Pri-2 Pri-1
Cc: dtapu...@chromium.org
Owner: chongz@chromium.org
chongz@; Can you have a look?
It looks like OS X swaps the scan codes 0x0A and 0x32 depending on the keyboard type or keyboard layout. I suspect this requires a mac-specific runtime test in the NativeKeycode conversion functions, or maybe just in |DomCodeFromNSEvent()|. I think the thing to test is the value of |KBGetLayoutType(LMGetKbdType())| but I don't know whether the exchange test should be |== kKeyboardISO| or |!= kKeyboardANSI| … someone will have to test whether the kKeyboardJIS case swaps or not.
  
I just tested this with a 102 keyboard on Mac:

Upper left '`' key:
ISO: IntlBackslash
ANSI: Backquote
JIS: Backquote

Betixt ShiftLeft and KeyZ:
ISO: Backquote
ANSI: IntlBackslash
JIS: IntlBackslash

Corresponding Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1263302

Comment 9 by chongz@chromium.org, Apr 13 2016

Tested on Apple's ISO French Canadian keyboard and |code| for those two keys are the same across platforms (although on Mac the produced character does not match |code|).

Upper left '`' key: (labeled as '\/|')
         |code|           character
Mac:     IntlBackslash        @
Linux:   IntlBackslash        <
Windows: IntlBackslash        <

Betwixt ShiftLeft and KeyZ: (labeled as 'ù')
           |code|           character
Mac:       Backquote          <
Linux:     Backquote          ²
Backquote: Backquote          ²

It seems reasonable to keep the same |code| across platforms for one keyboard, or do we want to swap |code| based on OS? (Or am I using the wrong keyboard?)

Link to the keyboard I'm using: http://www.apple.com/ca/shop/product/MB110C/B/apple-keyboard-with-numeric-keypad-french
Blockedon: 608493
Status: Started (was: Assigned)
Project Member

Comment 12 by bugdroid1@chromium.org, May 11 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ba1eb3a80a5fe90b236518a3005f0b6cbde8de00

commit ba1eb3a80a5fe90b236518a3005f0b6cbde8de00
Author: chongz <chongz@chromium.org>
Date: Wed May 11 17:27:49 2016

[Mac DomCode] Swap 'IntlBackslash' and 'Backquote' on ISO keyboard

According to spec the key to the left of Digit1 should produce DomCode
'Backquote', and the key between ShiftLeft and KeyZ should produce
DomCode 'IntlBackslash'.

The current issues are:
1. On Mac the |keyCode| were swapped on Apple's 102 French keyboard
and PC ISO 102 French keyboard.

2. On Linux and Windows the DomCode were swapped on Apple's 102 French
keyboard.

It sounds like Apple wired their keyboards with the keys swapped, so
we will fix issue 1 on Mac side by swapping these two keys back.

However we could not find a way to detect Apple's keyboard on Linux
and Windows, so we will leave the issue assuming it's rare to use an
Apple's keyboard on PC. (https://crbug.com.608493)

SPEC=https://w3c.github.io/uievents-code/#keyboard-102
BUG= 600607 
TEST=https://cdn.rawgit.com/w3c/uievents/gh-pages/tests/key-mtest-102fr-fr.html

Review-Url: https://codereview.chromium.org/1943553002
Cr-Commit-Position: refs/heads/master@{#392970}

[modify] https://crrev.com/ba1eb3a80a5fe90b236518a3005f0b6cbde8de00/ui/events/keycodes/keyboard_code_conversion_mac.mm

Components: IO>Keyboard Blink>Input
Labels: -M-51 Hotlist-Input-Dev M-52
Status: Fixed (was: Started)
The issue was fixed on Mac side when connect with
  1. Apple's ISO 102 French keyboard
  2. PC ISO 102 French keyboard
  3. Other PC ANSI and JIS keyboard with layout set to ISO in OS X
  (4. Apple's JIS keyboard doesn't have this issue since there is no Backquote key)

The remaining case for the issue (should be rare and WontFix):
  1. Apple's ISO 102 keyboard on Linux and Windows

Sign in to add a comment