Re: [w3c/uievents] no way to distinguish printable key values from non-printable (#264)

> So far we are looking to decode the given key as a UTF-32 sequence, and test if it is a single UTF-32 glyph, and assume the key is printable if so, but it is unclear if that will be guaranteed.

More specifically, what we are looking at is the following:

```js
function isPrintableKeyEvent(event) {
  var codeUnit = event.key.charCodeAt(0);
  var isLeadSurrogate = (codeUnit >= 0xD800 && codeUnit <= 0xDFFF);
  return event.key.length == 1 || (event.key.length == 2 && isLeadSurrogate);
}
```

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

Message ID: <w3c/uievents/issues/264/1108352271@github.com>

Received on Monday, 25 April 2022 09:59:36 UTC