KeyboardEvent.key holds the wrong value for Command-Shift-modified printable keys
Categories
(Core :: DOM: Events, enhancement, P5)
Tracking
()
People
(Reporter: marijnh, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
|
1.51 KB,
text/html
|
Details |
When Shift and Command are held and a printable key that produces a different character with Shift than without Shift is pressed, the keydown event's "key" property will, on macOS, hold the non-shifted variant. This problem does not exist with Control.
The spec is slightly vague on this, but this tweet from one of its authors indicates that the intent is for the shifted character to be provided in this case: https://twitter.com/garykac/status/1212759678024740864
Chrome and Safari have the same issue. See https://bugs.webkit.org/show_bug.cgi?id=174782
Comment 1•5 years ago
|
||
Hi! I will set Product and Component to have a starting point for this.
DOM: Events team, if this is not the right component please feel free to route this ticket to the corresponding team, thanks!
Comment 2•5 years ago
|
||
Comment 3•5 years ago
•
|
||
By attachment 9141288 [details], I can see the symptom on Mac
The key is "L" when pressing "shift" and "shift+ctrl" with "l".
But the key is "l" when pressing "shift + command" with l.
-
keydown charCode=0 key=L character=|| modifiers=Shift
-
keyup charCode=0 key=L character=|| modifiers=Shift
-
keydown charCode=0 key=L character=|| modifiers=Ctrl+Shift
-
keyup charCode=0 key=L character=|| modifiers=Ctrl+Shift
-
keydown charCode=0 key=Meta character=|| modifiers=Meta
-
keydown charCode=0 key=l character=|| modifiers=Shift+Meta ----> key is 'l'
-
keydown charCode=0 key=l character=|| modifiers=Shift+Meta
-
keyup charCode=0 key=Meta character=||
Comment 4•5 years ago
•
|
||
This symptom doesn't happen on Win 10.
Hello masayuk,
Could you have some comments about this?
(On Win 10)
-
keydown charCode=0 key=L character=|| modifiers=Shift
-
keyup charCode=0 key=L character=|| modifiers=Shift
-
keydown charCode=0 key=L character=|| modifiers=Ctrl+Shift
-
keyup charCode=0 key=L character=|| modifiers=Ctrl+Shift
-
keydown charCode=0 key=OS character=||
-
keyup charCode=0 key=L character=|| modifiers=Shift -------> key is 'L'
Updated•5 years ago
|
Comment 5•5 years ago
|
||
This is currently intentional. If OS provides "modified" character for the key, we use it as-is. And macOS sends unshifted character to apps when Command key is pressed. From web-compart point of view, we cannot change our behavior until Blink changes their behavior. As I said in the spec issue, we need to take care of complicated cases if Command switches layout temporarily like Dvorak-QWERTY command keyboard layout.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•3 years ago
|
Description
•