From 8c7b9817e8c4cd81501cca38aa66b3545bd1217d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20G=C3=A1mez=20Franco?= Date: Sat, 28 Nov 2020 23:47:10 +0100 Subject: [PATCH 1/3] Add information about virtual/mobile keyboards and an additional keyboard inspection tool. --- 2-ui/3-event-details/7-keyboard-events/article.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/2-ui/3-event-details/7-keyboard-events/article.md b/2-ui/3-event-details/7-keyboard-events/article.md index 617852cc..33fa1d51 100644 --- a/2-ui/3-event-details/7-keyboard-events/article.md +++ b/2-ui/3-event-details/7-keyboard-events/article.md @@ -21,6 +21,8 @@ Try different key combinations in the text field. [codetabs src="keyboard-dump" height=480] ``` +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. + ## Keydown and keyup @@ -170,6 +172,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 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). + +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. From 9f2d2005a423fd46a8b6a5730ecc67dd41837bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20G=C3=A1mez=20Franco?= Date: Mon, 14 Dec 2020 19:20:03 +0100 Subject: [PATCH 2/3] Update 2-ui/3-event-details/7-keyboard-events/article.md Co-authored-by: Vse Mozhe Buty --- 2-ui/3-event-details/7-keyboard-events/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-ui/3-event-details/7-keyboard-events/article.md b/2-ui/3-event-details/7-keyboard-events/article.md index 33fa1d51..549d30c8 100644 --- a/2-ui/3-event-details/7-keyboard-events/article.md +++ b/2-ui/3-event-details/7-keyboard-events/article.md @@ -174,7 +174,7 @@ There were so many browser incompatibilities while working with them, that devel ## Mobile Keyboards -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). +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. From 04b1313922f93edc5ca7ac79d60b9c600032b0e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20G=C3=A1mez=20Franco?= Date: Sun, 3 Jan 2021 11:21:28 +0100 Subject: [PATCH 3/3] Remove keyjs.dev link under the key codes inspection snippet. --- 2-ui/3-event-details/7-keyboard-events/article.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/2-ui/3-event-details/7-keyboard-events/article.md b/2-ui/3-event-details/7-keyboard-events/article.md index 549d30c8..54bde42b 100644 --- a/2-ui/3-event-details/7-keyboard-events/article.md +++ b/2-ui/3-event-details/7-keyboard-events/article.md @@ -21,8 +21,6 @@ Try different key combinations in the text field. [codetabs src="keyboard-dump" height=480] ``` -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. - ## Keydown and keyup