Skip to content

Commit 8c7b981

Browse files
authored
Add information about virtual/mobile keyboards and an additional keyboard inspection tool.
1 parent 6ec4c4f commit 8c7b981

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

2-ui/3-event-details/7-keyboard-events/article.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Try different key combinations in the text field.
2121
[codetabs src="keyboard-dump" height=480]
2222
```
2323

24+
If you'd like to see some of the many other properties inside a `KeyboardEvent`, you can use [Key.js](https://keyjs.dev), a similar keyboard event inspection tool.
25+
2426

2527
## Keydown and keyup
2628

@@ -170,6 +172,12 @@ In the past, there was a `keypress` event, and also `keyCode`, `charCode`, `whic
170172

171173
There were so many browser incompatibilities while working with them, that developers of the specification had no way, other than deprecating all of them and creating new, modern events (described above in this chapter). The old code still works, as browsers keep supporting them, but there's totally no need to use those any more.
172174

175+
## Mobile Keyboards
176+
177+
When using virtual/mobile keyboards, formally know as IME (Input-Method Editor), the W3C standard states that a KeyboardEvent's [`e.keyCode` should be `229`](https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode) and [`e.key` should be `"Unidentified"`](https://www.w3.org/TR/uievents-key/#key-attr-values).
178+
179+
While some of these keyboards might still use the right values for `e.key`, `e.code`, `e.keyCode`... when pressing certain keys such as arrows or backspace, there's no guarantee, so your keyboard logic might not always work on mobile devices.
180+
173181
## Summary
174182

175183
Pressing a key always generates a keyboard event, be it symbol keys or special keys like `key:Shift` or `key:Ctrl` and so on. The only exception is `key:Fn` key that sometimes presents on a laptop keyboard. There's no keyboard event for it, because it's often implemented on lower level than OS.

0 commit comments

Comments
 (0)