Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.11.1
-
None
Description
One can reproduce within the Nano Browser example. Run the example, open the DevTools console using the dropdown menu on the right of the URL bar, and then try debugging a key event with something like:
document.addEventListener("keydown", function(event) { if (event.keyCode == 65) { debugger; } });
Then, focus the open page, and type Ctrl + Shift + A. The debugger will pause execution, and you can then inspect variables within scope.
I notice a few oddities for the key down event:
- The key attribute is the empty string; I would expect it to be the uppercase A;
- The code attribute is wrong, and displays "KeyS". It seems to display this code regardless of what keys were pressed. I would expect KeyA in this case.
I don't see either of these issues in Chrome 67.0.3396.99, Firefox 61.0.1.
Note that these attributes are necessary for determining the actual key pressed by the user, as key codes are not unique across different keyboard layouts. For example, the comma key , has a key code of 188 when using a keyboard with an English layout, and the left-arrow key < also has a key code of 188 when using a keyboard with a German layout.
Attachments
Issue Links
- depends on
-
QTBUG-69608 cocoa: key press events for modifier keys do not have nativeVirtualKey
- Closed
- relates to
-
QTBUG-70151 Bare 'Ctrl' / 'Command' keypresses are swapped
- Closed
- resulted in
-
QTBUG-81783 event.key shows corrupt value for some key combinations
- Closed
-
QTBUG-71454 Option key accents add an extra character on macOS/Webengine+Japanese input
- Closed