Re: [w3c/uievents] Clarify `keypress` event handling for keys that map to non-BMP Unicode symbols (Issue #346)

> I believe Masayuki's point is that `String.fromCharCode()` takes a sequence of UTF-16 code-units, not UCS4 code-units (i.e. code-points). Changing the legacy `charCode` to return Unicode code-points rather than UTF-16 code-units would mean "char code" being used inconsistently across different contexts.

Yes, that's what my point is.  If `.charCode` may contain non-BMP character's code point, web apps need to use `String.fromCodePoint` instead. However, `.charCode` exists for older web apps. Therefore, I assume that changing the meaning would break the not-maintained web apps will be broken if the use `.fromCharCode`.

If web apps wants to access a (maybe) valid Unicode character, `.key` is available since [6 years ago](https://caniuse.com/?search=KeyboardEvent.key). Therefore, we should keep the legacy API behavior as-is for avoiding to break web apps in the wild.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/346#issuecomment-1573118624
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/uievents/issues/346/1573118624@github.com>

Received on Friday, 2 June 2023 04:10:46 UTC