Merge pull request #2389 from Danziger/patch-1
Add information about virtual/mobile keyboards and an additional keyboard event inspection tool.
This commit is contained in:
commit
039716de8a
1 changed files with 6 additions and 0 deletions
|
@ -170,6 +170,12 @@ In the past, there was a `keypress` event, and also `keyCode`, `charCode`, `whic
|
|||
|
||||
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.
|
||||
|
||||
## Mobile Keyboards
|
||||
|
||||
When using virtual/mobile keyboards, formally known 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).
|
||||
|
||||
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.
|
||||
|
||||
## Summary
|
||||
|
||||
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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue